I have a problem with linking binaries compiled with ifort 10.0 and gcc. The main code is written in fortran with some subroutines in C. Everything compiles correctly but it doesn't link. I get the following errors when linking:
ifort -c -O problemQCQP.f
ifort -c -O exampleProgram.f
gcc -c -O -I/usr/local/knitro-5.1.2-student/include knitro_fortran.c
ifort -o example_static problemQCQP.o exampleProgram.o knitro_fortran.o /usr/local/knitro-5.1.2-student/lib/libknitro.a -ldl -cxxlib
exampleProgram.o(.text+0xd4): In function `MAIN__':
: undefined reference to `ktrf_open_instance_'
exampleProgram.o(.text+0xd9): In function `MAIN__':
: undefined reference to `ktrf_load_param_file_'
exampleProgram.o(.text+0x134): In function `MAIN__':
: undefined reference to `ktrf_init_problem_'
exampleProgram.o(.text+0x176): In function `MAIN__':
: undefined reference to `ktrf_solve_'
exampleProgram.o(.text+0x1d5): In function `MAIN__':
: undefined reference to `ktrf_close_instance_'
make: *** [example_static] Error 1
AmI missing some libraries which I have to include for this to work or is there a compatibility isssue? When using g77 on this simple example program everything compiles and links correctly (using libstdc++). The problem is that I have my code written in Fortran 95 and it is compiled with ifort so I really need this to run using ifort instead of g77. The system I'm runnning is the following:
Linux aveden.localdomain 2.6.9-55.0.12.ELsmp #1 SMP Wed Oct 17 08:19:30 EDT 2007 i686 i686 i386 GNU/Linux
ifort (IFORT) 10.0 20070426
gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
I would really appreciate any help with this problem.