关于LNK2001错误MSDN中的文章

 
Knowledge Base   
You receive an "error LNK2001: unresolved external symbol ___argc" error message when the MFC library and the CRT library do not match in debug/release or in static/dynamic in Visual C++
Article ID: 166504
Article Last Modified on 6/2/2005
________________________________________
________________________________________
This article was previously published under Q166504
SYMPTOMS
When the MFC and CRT (C Run-Time) libraries do not match in debug/release or in static/dynamic, you get errors such as the following when linking:
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
Many other strange problems may erupt during build or runtime: memory corruption, memory leaks, complaints from the debug C Run-Time libraries during run-time, and more.
CAUSE
When building an MFC application or DLL, you need to insure that all relevant libraries are in sync:
If you have selected to build an application using MFC in the Shared Library, then you must also use the dynamic version of the C Run-Time (MSVCRT.DLL).
If you have selected to build a debug MFC application, then you must also use the debug version of the C Run-Time. Similarly, release MFC applications must use the non-debug version of the C Run-Time.
If your debug MFC application uses extension DLLs, every extension DLL must be a debug build as well. Again, release apps must match release extension DLLs. The type of C Run-Time library is fixed. Extension DLLs and the applications which use them must all use MFC in the shared library, which requires the dynamic DLL version of the C Run-Time.
If you are linking to any static libraries that also link to MFC or the CRT, you should ensure that every static library shares the same properties (debug/release, CRT-static/dynamic) as the application.
RESOLUTION
To change the type of C Run-Time library used by an application or DLL, go to the Build/Project settings property sheet and switch to the C/C++ tab. On the C/C++ page, choose the "Code Generation" category. Change the value of the "Use run-time library" listbox. Pay careful attention to make this specific for each configuration; only one configuration, such as "Win32 (80x86) Debug," should be selected when you change this value.
 
Debug, shared library MFC applications - "Debug Multithreaded Dll."
Release, shared library MFC applications - "Multithread Dll."
Debug, static library MFC applications - "Debug Multithreaded."
Release, static library MFC applications - "Multithreaded."
 
STATUS
This behavior is by design.
REFERENCES
For more information about CRT options and MFC, click the following article numbers to view the articles in the Microsoft Knowledge Base:
126646 PRB: Error Msg: LNK2001 on __beginthreadex and __endthreadex
Keywords: kbtshoot kberrmsg kbcrt kbprb KB166504 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值