VS2012常见错误及解决方法

VS2012常见错误及解决方法

1.当建立Win32 Console Application时,程序入口函数是

    int main(){}  或者  int _tmain(int argc, _TCHAR* argv[]){} 

正确配置是:

Configuration Properties->C\C++->Preprocessor->PreprocessorDefinitions:  

WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)

Configuration Properties->Linker->System->SubSystem:  

Console (/SUBSYSTEM:CONSOLE)

如果配置不正确,就会出现下面的错误:

///

Error 1 error LNK2019: unresolved external symbol _WinMain@16referenced in function ___tmainCRTStartup

Error 2 error LNK1120: 1 unresolved externals

//


    2.当建立Win32 Project时,程序入口函数是

int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
                      _In_opt_ HINSTANCE hPrevInstance,
                          _In_ LPTSTR    lpCmdLine,
                                                _In_ int       nCmdShow){}        

 正确配置是:

Configuration Properties->C\C++->Preprocessor->PreprocessorDefinitions: 

 WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)

Configuration Properties->Linker->System->SubSystem:  

WINDOWS(/SUBSYSTEM:WINDOWS)

如果配置不正确,就会出现下面的错误:

//

Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
Error 2 error LNK1120: 1 unresolved externals

//

     3.当建立MFC Applicationt时,程序入口函数是

int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,_In_ LPTSTR lpCmdLine, int nCmdShow){}

正确配置是:

Configuration Properties->C\C++->Preprocessor->PreprocessorDefinitions:  

WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)

Configuration Properties->Linker->System->SubSystem:  

WINDOWS(/SUBSYSTEM:WINDOWS)


如果配置不正确,就会出现下面的错误:

//

Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
Error 2 error LNK1120: 1 unresolved externals

//







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值