Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

Fortran Compiler Undefined Reference to Main

Michael_A_3
Beginner
3,560 Views

Hello All,

 

I am trying to compile CP2K using the Intel(R) Fortran 64 Compiler XE compiler. To optimize my code I have been playing with some of the compilation flags. When I add the flags 

-xSSE2 -no-ipo -fpp -free

My compilation fails with an error

/cm/shared/apps/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/for_main.o: In function `main':
/export/users/nbtester/efi2linux_nightly/branch-14_0/20140121_010000/libdev/frtl/src/libfor/for_main.c:(.text+0x42): undefined reference to `MAIN__'
make[3]: *** [/home/agiorm/cp2k-2.6.2/exe/komodonotracebackfast/dbcsr_example_1.popt] Error 1

 

I looked up the main file it listed but it was a simple binary file.

 

Has anyone seen this type of behavior before and would have a suggestion on how to fix it?

 

 

 

0 Kudos
1 Reply
Steven_L_Intel1
Employee
3,560 Views

If you are compiling a single source and not building an executable application, add -c for "compile only". Otherwise it will try to link an executable.

If the main program is not in Fortran, then add -nofor-main to the ifort command that does the link.

0 Kudos
Reply