Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

-ipo and undefined reference to 'MAIN__'

mpv1
Beginner
677 Views

Hello, I am a quite novice ifort user. I need to compile my program with -ipo option. It fails with the message:

ifort_8.1.024/lib/for_main.o(.text+0x28): In function `main': undefined reference to `MAIN__'

It only works when I specify -ipo_obj as well. This compiler behaves the same way on the following short program:

program for_main
    integer :: a
 
    a = 0
end program for_main
Any idea? Thanx, Pavel
0 Kudos
2 Replies
Steven_L_Intel1
Employee
677 Views
Try changing the name of your program from for_main to something else, as I think there is a library routine by that name.
0 Kudos
mpv1
Beginner
677 Views

Look plz at my output

[]$ ifort -c -ipo test.F90 
[]$ ifort -o test test.o
ifort_8.1.024/lib/for_main.o(.text+0x28): In function `main':
: undefined reference to `MAIN__'
[]$ nm test.o
(nm shows nothing)

And using -ipo_obj

[]$ ifort -c -ipo -ipo_obj test.F90
[]$ ifort -o test test.o
(no errors)
[pmankevi@nstmklel1 bld]$ nm test.o
                 U for_set_reentrancy
0000000000000000 d LITPACK_0.0.0
0000000000000000 T MAIN__

I understand -ipo doesn't generate .o files the same way the compiler does without -ipo. But fortran user guied doesn't mention that I must specify -ipo_obj along with -ipo flag. Is it correct, or there is some other way of using -ipo without -ipo_obj and above error could be avoided?

Pavel
0 Kudos
Reply