- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.

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