- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to compile my code with intel fortran and C++ compiler. Part of the code is written in Fortran and thus compiled by ifort and the other part written in C and compiled by icc. Now here is the output of the linker:
/opt/intel_fce_80/bin/ifort -I/opt/intel/cmkl/8.1/include -I/home/pdu/libfdr/include -I/usr/local/topspin/mpi/mpich/include -I. -L/opt/intel/cmkl/8.1/lib/em64t -L/home/pdu/libfdr/lib -L/usr/local/topspin/mpi/mpich/lib64 -L/home/pdu/lib/scalapack-1.7.4 -L/home/pdu/lib/LAPACK -L/usr/local/topspin/lib -o test_lu.x test_lu.o pdlaprnt.o tpdgetf2.o tpdgetrf.o tpdlaswp.o util.o -lmkl_scalapack -lscalapack -lmkl_blacs -lmkl_lapack -lmkl_em64t -lmpich -lvapi -lmosal -lmtl_common -lmpga -lguide -lpthread
test_lu.o(.text+0x0): In function `main':
: multiple definition of `main'
/opt/intel_fce_80/lib/for_main.o(.text+0x0): first defined here
ld: Warning: size of symbol `main' changed from 70 in /opt/intel_fce_80/lib/for_main.o to 1808 in test_lu.o
ld: warning: i386 architecture of input file `test_lu.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `util.o' is incompatible with i386:x86-64 output
/opt/intel_fce_80/lib/for_main.o(.text+0x2e): In function `main':
: undefined reference to `MAIN__'
I have no idea why this is happening and I hope to use my main function in my C code. So, does anyone know how to get through this?
Thanks.
/opt/intel_fce_80/bin/ifort -I/opt/intel/cmkl/8.1/include -I/home/pdu/libfdr/include -I/usr/local/topspin/mpi/mpich/include -I. -L/opt/intel/cmkl/8.1/lib/em64t -L/home/pdu/libfdr/lib -L/usr/local/topspin/mpi/mpich/lib64 -L/home/pdu/lib/scalapack-1.7.4 -L/home/pdu/lib/LAPACK -L/usr/local/topspin/lib -o test_lu.x test_lu.o pdlaprnt.o tpdgetf2.o tpdgetrf.o tpdlaswp.o util.o -lmkl_scalapack -lscalapack -lmkl_blacs -lmkl_lapack -lmkl_em64t -lmpich -lvapi -lmosal -lmtl_common -lmpga -lguide -lpthread
test_lu.o(.text+0x0): In function `main':
: multiple definition of `main'
/opt/intel_fce_80/lib/for_main.o(.text+0x0): first defined here
ld: Warning: size of symbol `main' changed from 70 in /opt/intel_fce_80/lib/for_main.o to 1808 in test_lu.o
ld: warning: i386 architecture of input file `test_lu.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `util.o' is incompatible with i386:x86-64 output
/opt/intel_fce_80/lib/for_main.o(.text+0x2e): In function `main':
: undefined reference to `MAIN__'
I have no idea why this is happening and I hope to use my main function in my C code. So, does anyone know how to get through this?
Thanks.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add -nofor_main to the ifort line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also notice that test_lu.o and util.o are compiled at i386 and not x86-64. You wont be able to link until you fix that.

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