- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
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
Ссылка скопирована
3 Ответы
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
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
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Oh sorry, it is really a C++ program, that was a typo up there.
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Add -nofor_main to the ifort command doing the link. This tells ifort that the main program is not Fortran.

Ответить
Параметры темы
- Подписка на RSS-канал
- Отметить тему как новую
- Отметить тему как прочитанную
- Выполнить отслеживание данной Тема для текущего пользователя
- Закладка
- Подписаться
- Страница в формате печати