- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
/link /nodefaultlib:libifcore.lib
to tell Microsoft linker you don't want the non-threaded library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Easiest way is to just add the .lib to your project as if it were a source file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

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