Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29242 ディスカッション

use /NODEFAULTLIB:library

wen
ビギナー
5,073件の閲覧回数

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 件の賞賛
7 返答(返信)
Steven_L_Intel1
従業員
5,073件の閲覧回数
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.
wen
ビギナー
5,073件の閲覧回数

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.

Steven_L_Intel1
従業員
5,073件の閲覧回数
Sorry, I guess I was thinking of something else.

In the selection for "Runtime Library", choose "Multithreaded" instead of "Debug Multithreaded".
wen
ビギナー
5,073件の閲覧回数

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.

Steven_L_Intel1
従業員
5,073件の閲覧回数
You still have some objects compiled with "Debug Multithreaded". It could be in one of the libraries you are linking in.
wen
ビギナー
5,073件の閲覧回数

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?

Steven_L_Intel1
従業員
5,073件の閲覧回数
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.
返信