Link error-library conflict (libcmt. lib and libcmtd. Lib)

Source: Internet
Author: User

In the same project, all source files must be linked to the same C Runtime Library. If a file uses the multithreaded dll version, and other files use the single-threaded or multithreaded version library, that is to say, different libraries will cause this warning.

 

 

 

In a word, there is a conflict between Lib. Some libs to be imported must be deleted.

 

Version Type Library Used Ignored Library
R release Single thread Libc. Lib Libcmt. Lib, msvcrt. Lib, libcd. Lib, libcmtd. Lib, msvcrtd. Lib
Multithreading Libcmt. Lib Libc. Lib, msvcrt. Lib, libcd. Lib, libcmtd. Lib, msvcrtd. Lib
Multithreading with DLL Msvcrt. Lib Libc. Lib, libcmt. Lib, libcd. Lib, libcmtd. Lib, msvcrtd. Lib
D debug Single thread Libcd. Lib Libc. Lib, libcmt. Lib, msvcrt. Lib, libcmtd. Lib, msvcrtd. Lib
Multithreading Libcmtd. Lib Libc. Lib, libcmt. Lib, msvcrt. Lib, libcmtd. Lib, msvcrtd. Lib
Multithreading with DLL Msvcrtd. Lib Libc. Lib, libcmt. Lib, msvcrt. Lib, libcd. Lib, libcmtd. Lib

For example, to compile a single-threaded project of the release version, add the following parameter to the linker command line:/nodefaultlib: libcmt. Lib
/Nodefaultlib: msvcrt. lib/nodefaultlib: libcd. lib/nodefaultlib: libcmtd. lib/nodefaultlib: msvcrtd. Lib

Solution:

Add/MTD or/mt to Cuda compilation options

Project Settings:

If a "libcmt" Conflict error exists, choose "configuration properties"> "linker"> "input"> "ignore a specified library. add lib or add/nodefaultlib: libcmt in "Additional Options" of "configuration properties --> linker --> Command run. lib
The libcmtd library sometimes cannot be ignored. If it is ignored, there will be an external symbol error that cannot be parsed.

In fact, when there is a convenient method link, add the parameter/Force: multiple.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.