Link: Warning lnk4098: the default library "libcmtd" conflicts with other libraries; Use/nodefaultlib: Library Category: small applications Read by 1037 Comment (0) Favorites Report This warning message is often encountered in the past, because there is no problem in the operation, so I did not go into details. However, I searched the internet for the success prompt "0 errors and 0 warnings. The original problem lies in the reference selection of the default library. Vs2008, project -- Property -- configuration Property -- C/C ++ --CodeGeneration: it has four options:/mt,/MTD,/MD, And/MDD. You must make the same configuration for all the databases in use; otherwise, a prompt will be displayed, functions that cannot be parsed may even occur. Sometimes the library we use is not controllable by ourselves, so we can only set the project attributes to the same option of the library you use. Error 1 error lnk2005: _ free has defined msvcrt. Lib in libcmtd. Lib (dbgheap. OBJ) Error 2 error lnk2005: _ malloc has defined msvcrt. Lib in libcmtd. Lib (dbgheap. OBJ) ..... If a bunch of redefinition errors occur in the same lib and conflict with it is the same Lib, the functions of the two lib should be the same. You can select either of them, you only need to enter the databases to be ignored in "ignore specific databases. Project properties-configuration properties-linker-input-ignore specific libraries: libcmtd. Lib Project properties-configuration properties-General-Use of MFC: use MFC in shared DLL Conflicts between msvcrt. lib and libcmt. Lib are still common. The error message shows that the _ isctype and other symbols are repeatedly defined in the msvcrt. lib and libcmt. Lib libraries. Why is this problem? This will start with the role of the two databases. Msvcrt. Lib is the C Runtime Library of multithreaded DLL in VC, while libcmt. Lib is the Runtime Library of multithreaded. 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. After we understand the meaning of the alarm information, we need to find the cause of the problem. In the project settings, we can see that the current project uses the multithreaded non-dll version of The Runtime Library, which indicates that there are other files in the project using the Runtime Library of another version. Obviously, it is the static library of OpenSSL. View the NT under MS in OpenSSL. mak, we can find that OpenSSL uses the compilation switch/MD for compiling in the static library version, that is, the OpenSSL static library is the default C Runtime Library of the multithreaded dll version. The cause is found. There are obviously two solutions. In short, the runtime libraries of the two projects are unified. The simple method is to change the dynamic library of the project to the C Runtime Library of multithreaded dll version. In some cases, your project may not change the current Runtime Library. You can change the/MD switch in the OpenSSL nt. Mak to/MT and re-compile the OpenSSL static library. The default library "library" conflicts with other libraries. Use the/nodefaultlib: Library lnk4098 solution. You are attempting to link to an incompatible library. Note that the Runtime Library now contains commands that prevent mixing different types of commands. If you try Program This warning is reported when different types of runtime libraries are used or when debug and non-DEBUG Versions are used. For example, if you compile a file to use one Runtime Library, and compile another file to use another Runtime Library (for example, single-thread Runtime Library for multi-thread Runtime Library ), and try to link them, this warning will be obtained. All source files should be compiled to use the same Runtime Library. For more information, see use the Runtime Library (/MD,/mt, And/LD) compiler options. You can use the/verbose: Lib switch of the linker to determine the library to search. If you receive lnk4098 and want to create executable files that use a single thread or a non-Debug Runtime Library, use the/verbose: Lib option to determine the library that the linker searches. The linker outputs libc. Lib as the Search Library, instead of libcmt. Lib, msvcrt. Lib, libcd. Lib, libcmtd. Lib, and msvcrtd. Lib. You can use/nodefalib Lib for each library to be ignored to notify the linker to ignore the wrong Runtime Library. The following table shows the databases to be ignored Based on the Runtime library to be used. To use the first row of Runtime Library, ignore these single-threaded libraries (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 Use multi-threaded DLL (msvcrt. Lib) libc. Lib, libcmt. Lib, libcd. Lib, libcmtd. Lib, and msvcrtd. Lib Debug single-thread (libcd. Lib) libc. Lib, libcmt. Lib, msvcrt. Lib, libcmtd. Lib, and msvcrtd. Lib Debug multiple threads (libcmtd. Lib) libc. Lib, libcmt. Lib, msvcrt. Lib, libcd. Lib, and msvcrtd. Lib Use DLL debugging multithreading (msvcrtd. Lib) libc. Lib, libcmt. Lib, msvcrt. Lib, libcd. Lib, libcmtd. Lib For example, if you receive this warning and want to create an executable file that uses a non-debug, single-threaded version of The Runtime Library, you can use the following options with the linker: /Nodefaultlib: libcmt. lib/nodefaultlib: msvcrt. lib/nodefaultlib: libcd. lib/nodefaultlib: libcmtd. lib/nodefaultlib: msvcrtd. Lib ========================================================== ====================================== Link: Warning lnk4098: defaultlib "msvcrt" conflicts with use of other libs; Use/nodefaultlib: Library Link: Warning lnk4098: defaultlib "libcmt" conflicts with use of other libs; use/nodefaultlib: librarylinker tools warning lnk4098 defaultlib "library" conflicts with use of other libs; Use/nodefaultlib: Library You are trying to link with incompatible libraries. Important the run-time libraries now contain ctictives to prevent mixing different types. you'll receive this warning if you try to use different types or debug and non-DEBUG Versions of the run-time library in the same program. for example, if you compiled one file to use one kind of run-time library and another file to use another kind (for example, single-threaded versus multithreaded) and tried to link them, you'll get this warning. you shoshould compile all source files to use the same run-time library. see the use run-time Library (MD,/ml,/mt,/LD) compiler options for more information. You can use the linker's/verbose: Lib switch to determine which libraries the linker is searching. if you receive lnk4098 and want to create an executable file that uses, for example, the single-threaded, non-Debug run-time libraries, use the/verbose: lib option to find out which libraries the linker is searching. the linker shoshould print libc. lib and not libcmt. lib, msvcrt. lib, libcd. lib, libcmtd. lib, or msvcrtd. lib as the libraries searched. you can tell the linker to ignore the incorrect run-time libraries by typing the incorrect libraries in the ignore libraries text box on the Link Tab Of the Settings dialog box in developer's studio or by using the/nodefalib Lib: library option with link for each library you want to ignore. see the ignore libraries (/nodefaultlib) linker option for more information. The table below shows which libraries shoshould be ignored depending on which run-time library you want to use. To use this run-time library ignore these libraries single-threaded (libc. lib) libcmt. lib, msvcrt. lib, libcd. lib, libcmtd. lib, msvcrtd. lib multithreaded (libcmt. lib) libc. lib, msvcrt. lib, libcd. lib, libcmtd. lib, msvcrtd. lib multithreaded Using DLL (msvcrt. lib) libc. lib, libcmt. lib, libcd. lib, libcmtd. lib, msvcrtd. lib debug single-threaded (libcd. lib) libc. lib, libcmt. lib, msvcrt. lib, libcmtd. lib, msvcrtd. lib debug multithreaded (libcmtd. lib) libc. lib, libcmt. lib, msvcrt. lib, libcd. lib, msvcrtd. lib debug multithreaded Using DLL (msvcrtd. lib) libc. lib, libcmt. lib, msvcrt. lib, libcd. lib, libcmtd. lib For example, if you have Ed this warning and you want to create an executable file that uses the non-debug, single-threaded version of the run-time libraries, you cocould use the following options with the linker: /Nodefaultlib: libcmt. lib/nodefaultlib: msvcrt. lib/nodefaultlib: libcd. lib/nodefaultlib: libcmtd. lib/nodefaultlib: msvcrtd. Lib The default library "library" conflicts with other libraries. Use/nodefaultlib: Library You are attempting to link to an incompatible library. Important: The Runtime Library now contains instructions to prevent mixing different types. This warning is reported if you try to use different types of runtime libraries in the same program or use runtime libraries of debug and non-DEBUG Versions. For example, if you compile a file to use one Runtime Library, and compile another file to use another Runtime Library (for example, single-thread Runtime Library for multi-thread Runtime Library ), and try to link them, this warning will be obtained. All source files should be compiled to use the same Runtime Library. For more information, see use the Runtime Library (/MD,/ml,/mt,/LD) compiler options. You can use the/verbose: Lib switch of the linker to determine the library to search. If you receive lnk4098 and want to create executable files that use a single thread or a non-Debug Runtime Library, use the/verbose: Lib option to determine the library that the linker searches. The linker outputs libc. Lib as the Search Library, instead of libcmt. Lib, msvcrt. Lib, libcd. Lib, libcmtd. Lib, and msvcrtd. Lib. You can use/nodefalib Lib for each library to be ignored to notify the linker to ignore the wrong Runtime Library. The following table shows the databases to be ignored Based on the Runtime library to be used. To use this Runtime Library, ignore these single-threaded libraries (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 uses multiple threads of DLL (msvcrt. lib) libc. lib, libcmt. lib, libcd. lib, libcmtd. lib, msvcrtd. lib debugging single-thread (libcd. lib) libc. lib, libcmt. lib, msvcrt. lib, libcmtd. lib, msvcrtd. lib debugging multithreading (libcmtd. lib) libc. lib, libcmt. lib, msvcrt. lib, libcd. lib, msvcrtd. lib uses multi-threaded DLL debugging (msvcrtd. lib) libc. lib, libcmt. lib, msvcrt. lib, libcd. lib, libcmtd. lib For example, if you receive this warning and want to create an executable file that uses a non-debug, single-threaded version of The Runtime Library, you can use the following options with the linker: /Nodefaultlib: libcmt. lib/nodefaultlib: msvcrt. lib/nodefaultlib: libcd. lib/nodefaultlib: libcmtd. lib/nodefaultlib: msvcrtd. Lib Http://blog.csdn.net/liangls1982/article/details/6297651 |