Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

LNK2005 error when compiling for Debug x64 (mixed C++/Fortran)

$
0
0

Hi all, I'm attempting to recompile a mixed C++/Fortran project for a x64 platform / Debug configuration but keep running into a LNK2005 error. The Fortran code is compiled to a static library while the C++ code -- which calls the Fortran code -- is compiled to a dynamic library. The error occurs when I attempt to compile the C++ code:

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: atanf already defined in MyFortranLibrary.lib(atanf_stub.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: atan2f already defined in MyFortranLibrary.lib(atan2f_stub.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: sqrtf already defined in MyFortranLibrary.lib(sqrtf_stub.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: cosf already defined in MyFortranLibrary.lib(cosf_stub.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: sinf already defined in MyFortranLibrary.lib(sinf_stub.obj)

Here, "MyFortranLibrary.lib" is the compiled Fortran library.

Things I've tried:

  • Added ..\Intel\Composer XE 2013 SP1\compiler\lib\intel64 directory to both projects' library directories
  • Set Runtime Library > Multithread Debug DLL for both projects
  • Cleaned and rebuilt projects

This seems to be the most prevalent solution (at least as far as I know), but doesn't seem to work in my case. I am able to compile for x32/Debug, x32/Release, and x64/Release. Please let me know if I've missed any information that may help diagnose the problem. Thanks!


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>