é¾æ¥æ¯ç½ç»æ¶ä»£ç产ç©ï¼æ¯æ¥ååºçç©åç¨ç½ç»ä¸ä¸æ¯è¯åå
¶ç念èå建çä¸ç§å
¨æ°çæ£ç´¢ç³»ç»ã
é¾æ¥ä¹æ¯ä¸ç§å¯ä»¥ææ帮å©è¯»è
æ£ç´¢æå
³èæ¯ææçç¸å
³èµæãè¿ä¸æ¥äºè§£æå
³æ
åµç好æ¹æ³ãé¾æ¥è¿ç§æ£ç´¢æ¹æ³å¯¹äºå¹´é´çç¼çºå¾æ帮å©ï¼å®è³å°å¯ä»¥è®©ä¸äºä¸å®ç¼å
¥æ¡ç®ä½å¯¹è¯»è
äºè§£å
¨é¢æ
åµåæä¸å®å¸®å©çæææä¸ä¸ªéå½çå¤æãè¿å¹´æ¥ï¼ä¸å°å¹´é´å·²å¨ä½¿ç¨âé¾æ¥âåè½ï¼è¿ç¨å¾å¾å¾ä½ãå½å
ææåæç§æ
åµéè¦è¿ä¸æ¥æä¾æææ¶ï¼åæ¶å®æä¸ä¸ªé¾æ¥ï¼å
å´è¯»è
å¦è¡è´¹æ¶æ¥æ¾ç麻ç¦ãæè
ä»ç»å®ç¥è¯åé¾æ¥ä¸ä¸ªèä¾ï¼æèæï¼ï¼å¯¹è¯»è
å æ·±ç解ååºç¨æä¾å¸®å©ãæ¯å¦ã西é¨ç¿ä¸å¹´é´ãï¼å½å
ææå°âéèéè·¯âãâ西çµä¸éâãâ西æ°ä¸è¾âãâåæ°´åè°âæ¶ï¼å°±å¨åä¸ä¸ªçé¢å æä¸ä¸ªâéèéè·¯âãâ西çµä¸éâãâ西æ°ä¸è¾âãâåæ°´åè°âçâé¾æ¥âï¼è¯¦ç»ä»ç»è¿å 项å½å®¶éç¹å·¥ç¨ã
é¤ç´¢å¼ãç®å½ãææãåè§ãé¾æ¥ã大äºè®°ç6ç§æ£ç´¢ç³»ç»å¤ï¼å¹´é´è¿æä¸äºè¾
å©çæ£ç´¢æ¹æ³ï¼æ¯å¦çé¢ãåå½ãéå½ã便è§ï¼ä»¥å广åç®å½çã
æå
³èçä¸è¥¿,ä¾å¦ç¨åº,ç½é¡µçç.ææ ¹è¿ä¸ªæ件.ç½é¡µæè
ç¨åºæå
³èç.å¨ç½é¡µä¸é常常è§.以ä¸è¿ä¸ªä¾å便å¯è¯´æ:ç½é¡µä¸å¯ä»¥ç¹å»,æè
å
°è²åä½ç,æä¸å线çå°±å«é¾æ¥.
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.
The table below shows which libraries should 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 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:msvcrtd.lib
温馨提示:内容为网友见解,仅供参考