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.
29285 Discussions

libifcoremt.lib : error LNK2005 .... already defined

longden_loo
Beginner
2,497 Views
I'm getting alot of "already defined" LNK2005 errors during linking, and both libraries (libifcoremt and libifcore) where the definitions are defined are part of the v9 compiler:
libifcoremt.lib(for_reentrancy.obj) : error LNK2005: _for_set_reentrancy already defined in libifcore.lib(for_reentrancy.obj)
Is there something I need to toggle to avoid getting this error?
0 Kudos
8 Replies
Steven_L_Intel1
Employee
2,497 Views
You're pulling in both the threaded and non-threaded version of the libraries. Make sure that all Fortran sources you link in were compiled with the same setting for "Libraries..Use run-time libraries".
0 Kudos
longden_loo
Beginner
2,497 Views
Thanks, I'll make that change.
This was a port from CVF ... was there an equivalent setting there? I don't recall manually specifying the "Runtime Library" type during the port for each of the 23 projects inmy solution.
0 Kudos
TimP
Honored Contributor III
2,497 Views
This usually means that you have both .obj built without a threading option (such as -Qparallel or -Qopenmp) and with such an option, including .obj from Intel Performance Libraries. The preferred solution is to turn on the appropriate option throughout. It may also be possible to suppress the complaint by using e.g.
/link /nodefaultlib:libifcore.lib
to tell Microsoft linker you don't want the non-threaded library.
0 Kudos
longden_loo
Beginner
2,497 Views
I don't see those options (-Qparallel or -Qopenmp) in the existing Visual Studio IDE, but setting all the project Runtime Library settings to "Debug Multithreaded" took care of all the LNK2005 complaints. Thanks.
Now down to only 2 link errors for this particular project, which is part of a large Fortran/C/Java application. The link error appears related to JNI (the C/Java interface) so it has nothing to do with Fortran (I think):
common.lib(AppInterface.obj) : error LNK2019: unresolved external symbol __imp__JNI_CreateJavaVM@12 referenced in function _App_createJavaVM
I tried adding the path to the Java jvm.dll to various places in the IDE with no success. Anyone here doing JNI on .NET that can suggest where I need to tweak it for JNI linking?
0 Kudos
Steven_L_Intel1
Employee
2,497 Views
It's not the DLL you want, but the JNI export library (.lib), if there is one. You would have had to specify this in CVF too.
0 Kudos
longden_loo
Beginner
2,497 Views
OK, I've confirmed there's a jvm.lib and the dumpbin command shows the references I'm looking for in there. I tried adding the jvm.lib path and filename to the project (Linker/Advanced/ImportLibrary) but it didn't seem to find it during the link.
Where in the .NET IDE do you specify the export libraries?
0 Kudos
Steven_L_Intel1
Employee
2,497 Views
Easiest way is to just add the .lib to your project as if it were a source file.
0 Kudos
longden_loo
Beginner
2,497 Views
That did it, thanks!
Also tried adding the path/filename to Linker/Input/AdditionalDependencies and that seemed to work too. I had tried this earlier without success, but it may have been due to some other problems.
0 Kudos
Reply