- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I currently try to link a C-program and a Fortran-subprogram with some libraries:
icc -c -Dr4 -Dp4 -DI686 testsuite.C
ifort -c solve_rate.f
ifort -g -L/opt/intel/fc/9.0/lib -lcprts -lcxaguard -lguide_stats -lifcoremt -limf -lirc_s -lsvml -lcxa -lguide -lifcore -lifcoremt_pic -lifport -lirc -lompstub -lunwind -o testsuite testsuite.o solve_rate.o
Precompiling works, however linking gives the following error messages:
/opt/intel/fc/9.0/lib/for_main.o(.text+0x39): In function `main':
: undefined reference to `MAIN__'
However, in testsuite.C, I have defined a function void MAIN__(). I also tried linking with ifort, but that gives the same error message. Does anybody have an idea what I can do?
Thank you in advance,
Dominik
I currently try to link a C-program and a Fortran-subprogram with some libraries:
icc -c -Dr4 -Dp4 -DI686 testsuite.C
ifort -c solve_rate.f
ifort -g -L/opt/intel/fc/9.0/lib -lcprts -lcxaguard -lguide_stats -lifcoremt -limf -lirc_s -lsvml -lcxa -lguide -lifcore -lifcoremt_pic -lifport -lirc -lompstub -lunwind -o testsuite testsuite.o solve_rate.o
Precompiling works, however linking gives the following error messages:
/opt/intel/fc/9.0/lib/for_main.o(.text+0x39): In function `main':
: undefined reference to `MAIN__'
However, in testsuite.C, I have defined a function void MAIN__(). I also tried linking with ifort, but that gives the same error message. Does anybody have an idea what I can do?
Thank you in advance,
Dominik
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dominik,
It looks as if icc interprets testsuite.C file as C++ source. If you rename it to testsuite.c or alternatively add extern "C" linkage to MAIN__ that willsolve the problem.
Dima
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh sorry, it is really a C++ program, that was a typo up there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add -nofor_main to the ifort command doing the link. This tells ifort that the main program is not Fortran.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page