Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Linker error message

michael_green
Beginner
399 Views
I recently placed some code that was working well in a library. Now when I link my program I get the following error message:
LINK : warning LNK4098: defaultlib "libc.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
It's not clear to me what this means or what I should do about it. Please can someone explain.
With many thanks in advance
Mike
0 Kudos
2 Replies
TimP
Honored Contributor III
399 Views
It won't be clear to us either, without more context. This could happen when one section of your code requires libcmt (threaded version), while another part requires libc (non-threaded), as a consequence of using different compile options.
0 Kudos
Steven_L_Intel1
Employee
399 Views
This is what we call "Multiple C Library Syndrome". When you compile a source file, the compiler adds linker directives to the object module to tell the linker which set of libraries to pull in at link time. As Tim suggests, these are different for threaded or not, debug or not, DLL or static. If the choice made when compiling the library objects is not the same as when compiling the main program, you get MCLS.

This is why, when a new Fortran Static Library project is created, the project wizard sets an option to tell the compiler not to generate these directives. This is the "Disable default library search rules" option under Libraries, or /libdir:noautomatic on the command line. Set this option for your library, rebuild your library, and the problem should go away.
0 Kudos
Reply