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.

gcc error while linking

sandeep_01
Beginner
3,112 Views

Hi,

I am using g++ to build my c++ code. I am using one library "libdbio.a" which is compiled in fortron complier ( intel, i think so). I have installed intel fortron composer XE2011 version on my suse10.4 64bit machine.

I am getting following linking error while linking the above mentioned library, please could you tell me what could be the problem.

g++ -O2 -Wall -I/Bala_backup/bala/Documents/XDB_Files_Linux -I/Bala_backup/bala/Documents/XDB_Files_Linux/OP2Writer -fPIC -o fno2xdb.x Common/FNO2XDBApp.o ./libdbio.a -L. -ldl /home/sandeep/Bala_backup/bala/Documents/XDB_Files_Linux/libfno2xdb.a ./libdbio.a
./libdbio.a(bioxxx.o): In function `bioxxx_routine':
/scratch/qasimtst/pb6/nastran1/util/dbio/bioxxx.c:(.text+0xf32): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
./libdbio.a(dbopen.o): In function `dbopen_':
/scratch/qasimtst/pb6/nastran1/obj/em64tL/util/dbio/dbopen.f:(.text+0x7c7): undefined reference to `for_inquire'
./libdbio.a(dbvald.o): In function `dbvald_':
/scratch/qasimtst/pb6/nastran1/util/dbio/dbvald.c:(.text+0x50): undefined reference to `_intel_fast_memcpy'
./libdbio.a(dioerr.o): In function `dioerr_':
/scratch/qasimtst/pb6/nastran1/obj/em64tL/util/dbio/dioerr.f:(.text+0x1f8): undefined reference to `for_write_seq_fmt'
/scratch/qasimtst/pb6/nastran1/obj/em64tL/util/dbio/dioerr.f:(.text+0x233): undefined reference to `for_write_seq_fmt_xmit'
/scratch/qasimtst/pb6/nastran1/obj/em64tL/util/dbio/dioerr.f:(.text+0x2ab): undefined reference to `for_write_int_fmt'
/scratch/qasimtst/pb6/nastran1/obj/em64tL/util/dbio/dioerr.f:(.text+0x320): undefined reference to `for_write_seq_fmt'
/scratch/qasimtst/pb6/nastran1/obj/em64tL/util/dbio/dioerr.f:(.text+0x35b): undefined reference to `for_write_seq_fmt_xmit'
/scratch/qasimtst/pb6/nastran1/obj/em64tL/util/dbio/dioerr.f:(.text+0x3d3): undefined reference to `for_write_int_fmt'

Thank you very much..

Regards,

Sandeep


0 Kudos
4 Replies
Udit_P_Intel
Employee
3,112 Views
The for_write_* libraries are Intel runtime libraries, so it seems that g++ can not locate these runtime libraries. I think the other experts on these forums will be able to help you more with those libraries. But I will suggest that you use the Intel compiler to compile your C++ code as well. You should use the -nofor_main switch which will enable you to have the main program in the C++ code. Something like this MAY work:
ifort -nofor_main -warn all -I/Bala_backup/bala/Documents/XDB_Files_Linux -I/Bala_backup/bala/Documents/XDB_Files_Linux/OP2Writer -o fno2xdb.x Common/FNO2XDBApp.o
Also, experiment with the -fPIC flag.
Best!
-Udit
0 Kudos
TimP
Honored Contributor III
3,112 Views
You will need to add all the libraries from the ifort installation which are referenced by your Fortran code. Often, it's simpler to use ifort in place of g++ to manage the link, adding -lstdc++ in order to satisfy g++.
0 Kudos
sandeep_01
Beginner
3,112 Views
thank you, very much TimP ..i supplied required ifort libs and it worked. thanks
0 Kudos
sandeep_01
Beginner
3,112 Views

thank you Udit, i tried but withought success, may be because i am new in the area and dint not explore all possibilities ..

Thank you very much for the promt reply.

0 Kudos
Reply