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

Link errors when building static DLL

Stephen_Painchaud
609 Views
I am using VS2010 with IVF12.1.

I am building static DLLs from static Fortran libraries with a C++ wrapper. For the debug configuration I have set all projects to use multithreaded debug libraries, and the release version is using multithreaded libraries. I have made sure thateach C++ project cofiguration is using the same library as the Fortran projects.

The debug configuration compiles correctly, but the release give me the following errors.

3>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)

3>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj)

3>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)

3>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj)

3>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj)

3>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)


I can eliminate the errors by telling the C++ project to ignore LIBCMTD.lib, but I dont understand why it would even try to use a debug library in the release configuration. I have double checked each project. Is there a switch somewhere else that may be causing problems?

0 Kudos
2 Replies
Steven_L_Intel1
Employee
609 Views
The linker warnings indicate that the library settings are not the same - that for the Debug configuration, one project is specifying debug multithread static libraries and the other is specifying non-debug libraries. You need to make them the same and then rebuild the projects.
0 Kudos
Stephen_Painchaud
609 Views
Thanks for the response. My library setting were ok, but the release version of the DLL was looking in the debug directories for the Fortran libraries. I must learn to be more careful when pasting paths from one configuration to another.

I better get another cup of coffee.
0 Kudos
Reply