VS2013新建一个空的win32应用程序时 出现了链接错误
1>------ Build started: Project: AutoUpdate, Configuration: Debug Win32 ------
1> Main.cpp
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>D:\Projects\AutoUpdate\Debug\AutoUpdate.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
具体过程及其解决方法如下
1、新建一个空的WIN32应用程序:
2、加入main函数:
3、直接编译链接出错:
4、加入代码:#include <tchar.h>后编译成功
完成代码如下:
#include <Windows.h>
#include <tchar.h>
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hInstance);
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(nCmdShow);
return 0;
}