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

use /NODEFAULTLIB:library

wen
Beginner
5,039 Views

I am compiling a set of codes through the Intel Composer XE 2011 Update 3 on Microsoft Visual Studio 2008 shell.

In the Debug configuration, the codes were compiled and linked successfully. But there is a warning message of

warning LNK4098: defaultlib libcmt.lib conflict with use of other libs; use /NODEFAULTLIB:library

Many static libraries were linked to the main program of ELCD. Attached are ten BuildLog.htm files for all the components associated with ELCD I built.

If I use /NODEFAULTLIB:library, there would be a lot of other linker errors. Should I ignore that message of use /NODEFAULTLIB:library? What could have caused that warning message?

Wen

0 Kudos
7 Replies
Steven_L_Intel1
Employee
5,039 Views
You are building a Debug configuration which, by default, links to the debug versions of the MSVC libraries. The other code you are linking in was built "Release", linking to the non-debug libraries. Thus the conflict.

This particular message is almost always bad advice. Better is to maske sure that all code in the application is using the same set of libraries. For you, I recommend going to the Fortran > Libraries property page and set the "Use debug libraries" property to No. You will still be able to debug your Fortran code. Of course, you'll want to do a Release build once you have debugged your code.
0 Kudos
wen
Beginner
5,039 Views

I am using Microsoft Visual Studio 2008 shell.

On the Fortran > Libraries property page, I dont see "Use debug libraries".

I see the flowing six lines

Runtime Library, set to Debug Multithreaded (/libs:static /threads /dbglib).

Use Common Windows Libraries, set tp No.

Use Portlib Library, set tp No.

Use Intel Math Kernel Library, set tp No.

Disable Default Library Search Rules, set tp No.

Disable OBJCOMMENT Library Names in O . . ., set tp No.

0 Kudos
Steven_L_Intel1
Employee
5,039 Views
Sorry, I guess I was thinking of something else.

In the selection for "Runtime Library", choose "Multithreaded" instead of "Debug Multithreaded".
0 Kudos
wen
Beginner
5,039 Views

I am compiling in the Debug configuration.

After "Debug Multithreaded" in all components are replaced by "Multithreaded," I got a bunch of LNK2005 errors as shown in the attached build log file, BuildLog-Dbg0810-ELCD-Multithreaded.htm.

0 Kudos
Steven_L_Intel1
Employee
5,039 Views
You still have some objects compiled with "Debug Multithreaded". It could be in one of the libraries you are linking in.
0 Kudos
wen
Beginner
5,039 Views

Yes, you were right. I still had one library compiled with Debug Multithreaded. The problem was solved after I had that Debug Multithreaded changed to Multithreaded. Thank you, Steve.

I am puzzled. How come I had never had this problem before (even for the same program of slightly different version)? Should I have Debug Multithreaded replaced by Multithreaded for all future compilation tasks in the Debug configuration?

0 Kudos
Steven_L_Intel1
Employee
5,039 Views
Can't say. Nothing has really changed here in over 10 years, other than MS doing away with libc.lib (static, single-threaded) and changing the defaults in C/C++ projects to use the DLL libraries.
0 Kudos
Reply