VC编译常见错误

 
1、Fatal Error C1010
unexpected end of file while looking for precompiled header directive
这一般是由于使用了参数/Yu"stdafx.h",意思是在每个文件中都应该使用#include来包含这个头文件。一般改正,就是在每个。CPP文件中包含这个文件就可以。
2、LNK2001 on __beginthreadex and __endthreadex
这是一个非常常见的链接错误。原因是由于在VC3。0以后所有的MFC类都是线程安全的,在MFC类库中使用了Thread Local Storage (TLS)提供预处理的数据。因此如果程序中包含了"stfafx.h"头文件或者使用了,MFC类库中的类就会使用MSVCRTx0.DLL 来进行链接。改正方法如下:
On Visual C 2.x, 5.0, and 6.0:
     Select the Project menu, and then continue Steps 2 through 5 below.
On Visual C 4.x:
      Select the Build menu.
      Select the Settings... option.
     Select the C/C++ tab.
     Select Code Generation on the Category list box.
     Finally, make a selection other than Single-Threaded on the Use Run Time Library list box.
      如果使用了"Multithreaded using DLL"方式还要求在预处理符号中加上_AFXDLL 符号.
      还在LIBC。LIB是C Runtime的静态链接库。
    MSVCRTx0.DLL 是C Runtime的动态链接库。
    如果程序中包含了任何MFC代码,或者编译使用了/MT选项,都要求使用多线程库。
    为什么在程序中包含了"StdAfx.h"文件也会出现这个连接错误呢?是由于在"StdAfx.h"中使用了MFC类,并且重载了new等操作符,如果在程序中使用了NEW等就会出现链接错误。
1、Fatal Error C1010
unexpected end of file while looking for precompiled header directive
这一般是由于使用了参数/Yu"stdafx.h",意思是在每个文件中都应该使用#include来包含这个头文件。一般改正,就是在每个。CPP文件中包含这个文件就可以。
2、LNK2001 on __beginthreadex and __endthreadex
这是一个非常常见的链接错误。原因是由于在VC3。0以后所有的MFC类都是线程安全的,在MFC类库中使用了Thread Local Storage (TLS)提供预处理的数据。因此如果程序中包含了"stfafx.h"头文件或者使用了,MFC类库中的类就会使用MSVCRTx0.DLL 来进行链接。改正方法如下:
On Visual C 2.x, 5.0, and 6.0:
     Select the Project menu, and then continue Steps 2 through 5 below.
On Visual C 4.x:
      Select the Build menu.
      Select the Settings... option.
     Select the C/C++ tab.
     Select Code Generation on the Category list box.
     Finally, make a selection other than Single-Threaded on the Use Run Time Library list box.
      如果使用了"Multithreaded using DLL"方式还要求在预处理符号中加上_AFXDLL 符号.
      还在LIBC。LIB是C Runtime的静态链接库。
    MSVCRTx0.DLL 是C Runtime的动态链接库。
    如果程序中包含了任何MFC代码,或者编译使用了/MT选项,都要求使用多线程库。
    为什么在程序中包含了"StdAfx.h"文件也会出现这个连接错误呢?是由于在"StdAfx.h"中使用了MFC类,并且重载了new等操作符,如果在程序中使用了NEW等就会出现链接错误。

http://www.blog.edu.cn/user2/shuquanying/archives/2006/1327664.shtml
Visual C++ Error Messages
Visual C++ Error Messages
This page contains a listing of "difficult to diagnose" error messages and possible fixes. I haven't taught a programming class that uses Visual C++ in several years so this list is probably out of date by now. It was valid for Microsoft Visual C++ version 6.0 service pack 3.
C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information
This error results from leaving off the parentheses immediately following the function name in a function header. To correct the error simply add () to the end of the function name.
C1010: unexpected end of file while looking for precompiled header directive
If your project is an MFC AppWizard created project then this error results from not #including StdAfx.h as the first #i nclude statement (before any other #i ncludes, data declarations, or executable program code).
C1083: Cannot open precompiled header file: 'Debug/<Project-Name>.pch': No such file or directory
This error results from a missing file - the compiled version of StdAfx.cpp. Visual C++ does a poor job of keeping track of this file and frequently "forgets" how to build it. This problem often occurs after restoring a saved workspace from diskette without the Debug directory. To fix the error select StdAfx.cpp from the workspace file list them choose Compile from the Build menu. If that doesn't work the go to Project -> Settings, select the C/C++ tab, and click the radio button labeled Create Precompiled Headers.
C2001: newline in constant
This error is usually caused by a string or character constant that is missing its closing ' or " symbol.
C2065: '<data-member name>' : undeclared identifier
If this error occurs in one of your member functions then it is generally the result of forgetting the class scope operator in front of the function name in your .cpp file.
C2143: syntax error : missing ';' before 'PCH creation point'
Check each of the #i nclude files to ensure that the closing brace of each class declaration is followed by a semicolon.
C2143: syntax error : missing ';' before '*'
If this error is followed by two C2501 errors then the problem is an undeclared class name within a pointer declaration.
For example, the declaration:
CClass *pObject;
will generate the above error message followed by a C2501 error message for 'CClass' and another C2501 message for 'pObject'. The problem is that the compiler isn't recognizing CClass as a valid class/type name. To correct the problem add a #i nclude of the file containing the declaration of CClass (e.g., #i nclude CClass.h)
C2447: missing function header (old-style formal list?)
This error usually results from a missing { or use of a ; instead of a { following the parameter list of a function header.
C2511: '<function-name>' : overloaded member function not found in '<class-name>'
This error results from a mismatch in the parameter list of a member function declaration (.h file) and definition (.ccp file). Check the forward declaration of the function in the .h file and its definition in the .cpp file and ensure that the number of parameters and the type of each parameter match exactly.
C2512: '<constructor-function-name>' : no appropriate default constructor available
This error usually occurs when you implement the constructor function of a derived class and forget to include parameter passing to the base class constructor function.   For example assume that CDerived is derived from CBase and that the CBase constructor function requires one parameter (e.g., int A). If you define the CDerived constructor function as:
CDerived::CDerived(int A, int B) { ... }
the compiler will issue the above error message on the line containing the function header of CDerived::CDerived() because you haven't provided instructions for routing the parameter A to CBase::CBase(). Because you didn't provide instructions the compiler assumes that CBase::CBase() requires no arguments and it complains because no version of CBase::CBase() has been defined that accepts zero arguments.
If you intended to provide a version of CBase::CBase() that requires no arguments then the error message indicates that you forgot to declare that function in your base class declaration (e.g., in CBase.h).
If CBase::CBase() does require one or more arguments then you must correct the problem by including explicit instructions for passing parameters from the derived class constructor function to the base class constructor function. The correction for the example above is:
CDerived::CDerived(int A, int B) : CBase(A) { ... }
C2556: '<function-name>' : overloaded functions only differ by return type
C2371: '<function-name>' : redefinition; different basic types
These errors usually result from a mismatch of function type between a .h and .cpp file. Check the forward declaration of the function in the .h file and its definition in the .cpp file and make the function return type identical in both files.
C2601: '<function-name>' : local function definitions are illegal
This error results from defining one function inside the body of another function.   It usually means that you omitted one or more } symbols in the function just before the function named in the error message.
C2653: '<Class-Name>' : is not a class or namespace name
This error usually results from not having #i nclude "StdAfx.h" as the first #i nclude statement in your class.cpp file. It can also occur if your class definition is in a .h file and you forget to #i nclude that .h file in another file that refers to the class name.
C2661: '<Class-Name>::<Function-Name>' : no overloaded function takes n parameters
This error indicates a mismatch between the parameters used in a function call (e.g., from main.cpp) and the declaration of the function. The function call is passing n parameters and there is no function declaration that uses that number of parameters.
LNK1104: Cannot open file nafxcwd.lib
This error sometimes occurs when a project uses a class from the MFC but the project settings don't explicitly tell the link editor to look in the MFC libraries.
Go to Project --> Settings (Build --> Settings in Visual C++ 4.0). On the General tab check the box that says "Use MFC in a Shared DLL".
LNK1168: cannot open Debug/<Project-Name>.exe for writing
This error occurs when the link editor attempts to write to a .exe file that is currently in use. The .exe file of an executing program is write protected until the program is terminated. Look at the status bar at the bottom of your screen and find the icon representing your executable application. Open the application and exit from it. Then select Build.
LNK2001: unresolved external symbol __endthreadex
LNK2001: unresolved external symbol __beginthreadex
These errors result from using an MFC object or function without telling the link editor to search the MFC libraries.
Go to Project --> Settings (Build --> Settings in Visual C++ 4.0). On the General tab check the box that says "Use MFC in a Shared DLL".
LNK2001: unresolved external symbol _main
Your project doesn't contain a function called main(). The error usually results from forgeting to add main.cpp to the project workspace.
<File>.obj : error LNK2001: unresolved external symbol "public: void __thiscall <Class1>::<Function1>(<Type>)"
This a generic form of a LNK2001 error where <File>.obj can be any object file in your project and <Class1>::<Function1>(<Type>) can be any function in any class. Substitute the specific <File>, <Class>, <Function>, and <Type> in your message into the instructions below to diagnose and correct the problem.
An LNK2001 error means that the link editor is looking for a compiled function and can't find it. The call to the "missing function" is somewhere in <File>.cpp. Unfortunately, double-clicking on the error message won't take you to the point in <File.cpp> where the function is called but you can search for it with Find or Find In Files. The function the link editor can't find is a member of <Class>, its name is <Function1>, and its return type is <Type>.
There are two common reasons for a LNK2001 error:
The call in <File>.cpp doesn't match the function prototype in <Class>.h and/or the implementation in <Class>.cpp. The mismatch may be in the function name, return type, or number and/or type of parameters.   Correction strategies include:
Check that the function name is spelled the same (case sensitive) in all three files (File.cpp, Class.h, and Class.cpp).
Check that the function is actually declared and defined within <Class> - perhaps you defined it as a member of a different class or perhaps you tried to call the function (in <File>.cpp) using an object or object pointer of a different class.
Check that the number and type of parameters in the function implementation (in <Class>.cpp) matches the number and type of parameters declared in the function declaration in <Class>.h.
Check that the number and type of parameters in the function call (in <File>.cpp) matches the number and type of parameters declared in the function header in <Class>.cpp.
The function was never declared or was declared but never defined. To see if either is the case go to the ClassView window of the Workspace view. Click the + next to <Class> and find <Function> in the list of member functions.
If <Function> is NOT in the list then it was never declared or defined - add a declaration to the class declaraion in <Class>.h and implement the function in <Class>.cpp.
If <Function> is in the list then right click on it and select Go To Definition from the pop-up menu. If you get the error message Cannot find definition (implementation) of this function then the function was declared but never defined (implemented). Implement the function to <Class>.cpp.

LNK2005: <some-long-string-of-mostly-garbage> already defined in <name>.lib(<name>.obj)
This error usually results from including a source code file multiple times. If you recognize any of the names in the message then it probably results from multiple inclusion of one of your own header files. Check to be sure that you've used #ifndef/#define/#endif properly your header files. If you don't recognize the name then it's probably multiple inclusion of a system file (e.g., afxwin.h). Make sure that you haven't explicitly included something in main.cpp that is already included in one of your own header files.   Also check that you haven't #i ncluded a .cpp file where you should have #i ncluded a .h file.
http://yinqing.blog.hexun.com/5383739_d.html
作 者:happyparrot   出处:http://community.csdn.net/Expert/topic/4258/4258967.xml?temp=.1825373
1. Linking...
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
    libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Q:
    VC++默认的工程设置是单线程的,而你使用了多线程,所以要修改设置。选择菜单“Project|settings”,选择C/C++标签,在CODE GENERATION分类中选择除SINGLE-THREADED的其他选择。
2.fatal error C1010: unexpected end of file while looking for precompiled header directive
Q:
    两个办法:
    -->肯定是一个新添加的类的.cpp文件开头没包含stdafx.h,在该文件最前面加上即可
    -->有时可以使用右键点击项目工程中的该cpp文件,选择setting,在c/c++栏,选择PreCompiled headers,然后设置第一选项,选择不使用预编译头,解决这个问题。
3.在编译时产生的下面的代码,那么下面的代码中的括号内的数字代表什么意思,还有error后的数字呢?
    Compiling...
    CalWnd.cpp
    E:/StudyVC/CalendarApp/CalWnd.cpp(1092) : error C2065: 'TTS_BALLOON' : undeclared identifier
    E:/StudyVC/CalendarApp/CalWnd.cpp(1092) : error C2059: syntax error : ')'
    E:/StudyVC/CalendarApp/CalWnd.cpp(1092) : warning C4552: '|' : operator has no effect; expected
operator with side-effect
    Error executing cl.exe.
Q:括号中的数字是出错的代码行的行号。例如错误中的第1行表示CalWnd.cpp的1092行出现了错误。如果想快速找到这行,可以在错误信息行上双击鼠标,这时VC++会自动打开CalWnd.cpp文件并定位到这行。
Error后面的数字表示错误代号。错误代号分为两类:C开头的是编译错误,即你的代码存在语法错误,你需要修改代码;LNK开头的是链接错误,通常你的代码并没有语法错误,可能是配置错误引起的,但有时LNK可能是由于拼写错误引起的。在错误信息行上按F1键,VC++会打开MSDN帮助并显示关于该错误信息的一个简单的解释,你可以根据该解释来知道到底是什么意思。
4.vc编译的时候可以设置两个版本:debug和release,debug版本在运行的时候点击帮助菜单的about对话框出现如下错误信息:
    Debug Assertion Failed:
    Program :C:/fuan/Debug/fuan.exe
    File:wincore.cpp
    Line:628

    For information on how your program can cause an assertion failure,see visual c++ documentation on asserts.
    (Please retry to debug application).
    但是如果把配置改成release版本,就不会出现问题,about对话框弹出正常。使用的是同一个源程序,为什么会出现不同的结果?
Q:
在MFC中,大量使用了ASSERT宏,这些宏通常可以来纠正一些错误,如还没有初始化指针就使用等。你所遇到的信息就是ASSERT宏报告的错误。通常你要检查一下是否存在错误。在Release方法下,ASSERT宏不会执行,所以也没有错误信息。不过,MFC中的ASSERT宏有时管得有点宽,如果确认没有错误,也可以不理会它。
5. 在win2000上能编译的程序到了win98就不能编译了。
    没有出错信息,一编译就停在
    --Configuration: Monitor - Win32 Release-------
    Copying contents file...
    是不是跟*.hpj文件有关系,应该怎么改?
Q:是和编译帮助文件有关,据说如果在Win98下安装了Norton AntiVirtus 2000就会出现这种问题。可以把帮助文件从工程中去掉:
    1、在FileView标签下,选择Source Files文件夹下面的.hpj文件。
    2、右击文件并从菜单中选择Settings。
    3、点击General标签。
    4、清除掉Always use custom build step选项并选择Exclude file from build。
6.在用EnumWindows(EnumWindowsProc,(LPARAM)0);编译时老是出错:cannot convert parameter 1 from 'int (struct HWND__ *,long)' to 'int (__stdcall *)(struct HWND__ *,long)'
Q:实际上看一下错误信息就知道,你的EnumWindowsProc大概定义为:
    int EnumWindowsProc(HWND, long);

    实际应该定义为:
    int __stdcall EnumWindowsProc(HWND, long);
7.编译以WinMain开头的函数出现LNK2001错误
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
Q:估计是选错了工程类型。在VC中除了可以编译MFC程序外,还可以建立Win32 Application,以WinMain为主函数。可以在VC中建立Win32 Application,然后加入你的C程序,然后编译即可。
8.编译后出现大量错误信息怎么办
错误信息如下:
    Info :Compiling C:/user/x.cpp
    Error: x.cpp(20,26):Call to undefined function 'loadCursor'
    Error: x.cpp(20,15):Cannot convert 'int' to 'HICON__ *'
    Error: x.cpp(23,21):Cannot convert 'void *' to 'HBRUSH__ *'
    Error: x.cpp(30,6):Undefined symbol 'hWnd'
    Error: x.cpp(32,13):Cannot convert 'void *' to 'HINSTANCE__ *'
    Error: x.cpp(32,13):Type mismatch in parameter 'hInstance' in call to
    '__stdcall CreateWindowExA(unsigned long,const char *,const char
    *,unsigned long,int,int,int,int,HWND__ *,HMENU__ *,HINSTANCE__ *,void
    *)'
    Error: x.cpp(33,32):Undefined symbol 'SHOW_MAXIMIZED'
    Warn : x.cpp(40,2):'hwnd' is declared but never used
    Warn : x.cpp(40,2):Parameter 'lpszCmdLine' is never used
    Warn : x.cpp(40,2):Parameter 'nCmdShow' is never used
    Error: x.cpp(54,20):Illegal structure operation
    Error: x.cpp(54,41):Undefined symbol 'tmExternalLeading'
    Error: x.cpp(56,40):Undefined symbol 'poshorzscoll'
    Error: x.cpp(57,40):Undefined symbol 'posvertscoll'
    Error: x.cpp(58,16):Call to undefined function 'SetSCrollRange'
    Error: x.cpp(135,73):Function call missing )
    Error: x.cpp(142,7):Misplaced break
    Error: x.cpp(143,5):Case outside of switch
    Error: x.cpp(143,17):Expression syntax
    Error: x.cpp(145,7):Misplaced break
    Error: x.cpp(146,8):Default outside of switch
    Warn : x.cpp(148,2):'slength' is declared but never used
    Error: x.cpp(149,7):Declaration terminated incorrectly
    Error: x.cpp(150,2):Unexpected }
Q:不可能一一为你分析错误,告诉你一些消除错误的原则,你自己来逐一分析,这样你才能学会编程。
    首先,用不着见到错误就六神无主。错误信息虽多,但没什么了不起。编译错误就象是拼写检查的结果。
    下面,看看有多少条错误信息(Error)和警告(Warn)。当然先分析错误信息,有些警告是由于错误信息产生的。如果你对某条错误信息的含义不了解,可以选择该条错误信息,然后按F1键,在帮助文件中肯定会有更详细的介绍。
    绝大多数编译错误实际上都是拼写错误。看看你的程序吧。凡是undefined错误都是拼写错误。象把LoadCursor写成loadCursor,hWnd写成hwnd,别忘了C/C++是区分大小写的!还有把SW_SHOWMAXIMIZED写成SHOW_MAXIMIZED。有时候记忆出了错误,查查手册或帮助就行了。
    接下来,要查“(”、“)”、“{”、“}”等各种括号的匹配问题。Function call missing )、Misplaced break、Case outside of switch这些信息都说明你的程序中存在匹配问题。你的程序中有一行 TextOut(hdc,-charwt*(poshorzscroll,charht*(t-posvertscroll),szbuffer,i);} 显然少了一个“)”括号。一般在检查这种错误时,必须找到第一个出现此类错误的地方,修改后一般立即重新
编译,因为一个匹配错误可能引发几十个错误,继续查后面的错误意义不大。
    剩下的Cannot convert、Type mismatch错误是数据类型转换错误。这其实不一定是错误,因为C++对参数类型检查的要严格一些,所以有时要尽可能使用强制类型转换来避免这种错误。比如你的
    wcAPP.hbrBackground=GetStockObject(WHITE_BRUSH);
    导致Cannot convert 'void *' to 'HBRUSH__ *'错误,你可以试着在相关参数前加上(HBRUSH),改成
    wcAPP.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
    对于这类转换,不同的C++系统可能不同,所以有的时候不写也可以,但我建议要强制转换,这样麻烦少。同时要注意变量类型是否可以强制转换,比如有的参数为指针类型,要在普通变量前加“&”操作符。这要参考有关函数的帮助。

VC++常见编译错误信息
1、fatal error C1010: unexpected end of file while looking for precompiled header directive
寻找预编译头文件路径时遇到了不该遇到的文件尾。(一般是没有#include "stdafx.h")
    2、fatal error C1083: Cannot open include file: 'R…….h': No such file or directory
不能打开包含文件“R…….h”:没有这样的文件或目录。
    3、error C2011: 'C……': 'class' type redefinition
类“C……”重定义。
    4、error C2018: unknown character '0xa3'
不认识的字符'0xa3'。(一般是汉字或中文标点符号)
    5、error C2057: expected constant expression
希望是常量表达式。(一般出现在switch语句的case分支中)
    6、error C2065: 'IDD_MYDIALOG' : undeclared identifier
“IDD_MYDIALOG”:未声明过的标识符。
    7、error C2082: redefinition of formal parameter 'bReset'
函数参数“bReset”在函数体中重定义。
    8、error C2143: syntax error: missing ':' before '{'
句法错误:“{”前缺少“;”。
    9、error C2146: syntax error : missing ';' before identifier 'dc'
句法错误:在“dc”前丢了“;”。
    10、error C2196: case value '69' already used
值69已经用过。(一般出现在switch语句的case分支中)
    11、error C2509: 'OnTimer' : member function not declared in 'CHelloView'
成员函数“OnTimer”没有在“CHelloView”中声明。
    12、error C2511: 'reset': overloaded member function 'void (int)' not found in 'B'
重载的函数“void reset(int)”在类“B”中找不到。
    13、error C2555: 'B::f1': overriding virtual function differs from 'A::f1' only by return type or calling convention
类B对类A中同名函数f1的重载仅根据返回值或调用约定上的区别。
    14、error C2660: 'SetTimer' : function does not take 2 parameters
“SetTimer”函数不传递2个参数。
    15、warning C4035: 'f……': no return value
“f……”的return语句没有返回值。
    16、warning C4553: '= =' : operator has no effect; did you intend '='?
没有效果的运算符“= =”;是否改为“=”?
    17、warning C4700: local variable 'bReset' used without having been initialized
局部变量“bReset”没有初始化就使用。
    18、error C4716: 'CMyApp::InitInstance' : must return a value
“CMyApp::InitInstance”函数必须返回一个值。
    19、LINK : fatal error LNK1168: cannot open Debug/P1.exe for writing
连接错误:不能打开P1.exe文件,以改写内容。(一般是P1.Exe还在运行,未关闭)
    20、error LNK2001: unresolved external symbol "public: virtual _ _thiscall C……::~C……(void)"
连接时发现没有实现的外部符号(变量、函数等)。
========================================================================================[/ft]
在创建MFC项目时, 不使用MFC AppWizard向导, 如果没有设置好项目参数, 就会在编译时产生很多连接错误, 如error LNK2001错误, 典型的错误提示有:
libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
msvcrtd.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
下面介绍解决的方法:
1. Windows子系统设置错误, 提示:
libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Windows项目要使用Windows子系统, 而不是Console, 可以这样设置:
[Project] --> [Settings] --> 选择"Link"属性页,
在Project Options中将/subsystem:console改成/subsystem:windows
2. Console子系统设置错误, 提示:
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
控制台项目要使用Console子系统, 而不是Windows, 设置:
[Project] --> [Settings] --> 选择"Link"属性页,
在Project Options中将/subsystem:windows改成/subsystem:console
3. 程序入口设置错误, 提示:
msvcrtd.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
通常, MFC项目的程序入口函数是WinMain, 如果编译项目的Unicode版本, 程序入口必须改为wWinMainCRTStartup, 所以需要重新设置程序入口:
[Project] --> [Settings] --> 选择"C/C++"属性页,
在Category中选择Output,
再在Entry-point symbol中填入wWinMainCRTStartup, 即可
4. 线程运行时库设置错误, 提示:
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
这是因为MFC要使用多线程时库, 需要更改设置:
[Project] --> [Settings] --> 选择"C/C++"属性页,
在Category中选择Code Generation,
再在Use run-time library中选择Debug Multithreaded或者multithreaded
其中,
Single-Threaded                单线程静态链接库(release版本)
Multithreaded                  多线程静态链接库(release版本)
multithreaded DLL              多线程动态链接库(release版本)
Debug Single-Threaded          单线程静态链接库(debug版本)
Debug Multithreaded            多线程静态链接库(debug版本)
Debug Multithreaded DLL        多线程动态链接库(debug版本)
单线程: 不需要多线程调用时, 多用在DOS环境下
多线程: 可以并发运行
静态库: 直接将库与程序Link, 可以脱离MFC库运行
动态库: 需要相应的DLL动态库, 程序才能运行
release版本: 正式发布时使用
debug版本: 调试阶段使用
  • 0
    点赞
  • 2
    收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
评论
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值