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

LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library

OP1
New Contributor III
3,854 Views
Dear forum,

I have a solution which contains a DLL, which in turns relies on a static library. When I build this DLL, I get the following warning message:

LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library

It is just a warning... but what should I do to eliminate it? What are the consequences of ignoring this warning?

Thanks,

Olivier
0 Kudos
3 Replies
Steven_L_Intel1
Employee
3,854 Views
World War III could start. Or you could get subtle run-time errors due to having two run-time libraries loaded.

Your static library was built with one choice for run-time libraries (probably multithread debug) and did not have the "OBJCOMMENT directives" for default libraries disabled (/Zl, or in Fortran, /libdir:noauto). Your DLL project specifies, by default, multithread DLL.

The solution is to make sure that all objects and libraries are compiled with the same setting for run-time libraries.
0 Kudos
OP1
New Contributor III
3,854 Views
World War III could start. Or you could get subtle run-time errors due to having two run-time libraries loaded.

Your static library was built with one choice for run-time libraries (probably multithread debug) and did not have the "OBJCOMMENT directives" for default libraries disabled (/Zl, or in Fortran, /libdir:noauto). Your DLL project specifies, by default, multithread DLL.

The solution is to make sure that all objects and libraries are compiled with the same setting for run-time libraries.

Ah ah thanks Steve... The scare tactics (re: WWIII) worked and I'll heed this warning. I am not sure however I fully grasp your answer. Are you suggesting that I should build my static library with the Debug Multithread DLL option? (for my Debug configuration, and I assume that for my release configuration I should use the Multithread DLL option)

Thanks in advance for clarifying this.

Olivier
0 Kudos
Steven_L_Intel1
Employee
3,854 Views

If your static library is all Fortran, then build it with Libraries > Disable Default Library Search Rules. This is usually the default for a Fortran static library project. Then it will rely on the libraries specified by your DLL project.

Otherwise, then, yes, I am suggesting building the static library with the Multithreaded DLL (Debug or not, as appropriate), to avoid coming down with MCLS (Multiple C Library Syndrome.)
0 Kudos
Reply