Linker Tools Warning LNK4098

xiaoxiao2021-03-06  82

Linker 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 directives 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 should 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 should 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 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 / NODEFAULTLIB: library option with LINK for each Library you want to ignore. See The ignore libraries (/ NodeFaultlib) Linker option for more information.

.

To use this run-time libraryIgnore these librariesSingle-threaded (libc.lib) libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.libMultithreaded (libcmt.lib) libc.lib, msvcrt.lib, libcd. lib, libcmtd.lib, msvcrtd.libMultithreaded using DLL (msvcrt.lib) libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.libDebug Single-threaded (libcd.lib) libc.lib, libcmt.lib , msvcrt.lib, libcmtd.lib, msvcrtd.libDebug Multithreaded (libcmtd.lib) libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.libDebug Multithreaded using DLL (msvcrtd.lib) libc.lib, libcmt .lib, msvcrt.lib, libcd.lib, libcmtd.libFor example, if you received this warning and you want to create an executable file that uses the non-debug, single-threaded version of the run-time libraries, you could use The Following Options with the Linker:

/Nodefaultlib:libcmt.lib /nodefaultlib: msvcrt.lib /nodefaultlib:libcd.lib /nodefaultlib:libcmtd.lib / NodeFaultlib Write program WARNING, feel uncomfortable. This warning adds the corresponding /nodefaultlib:xxx.lib on the link option.

转载请注明原文地址:https://www.9cbs.com/read-94767.html

New Post(0)