#include <windows.h>
#include <tchar.h>
int WINAPI _tWinMain( HINSTANCE hInstance,HINSTANCE hPrewInstance,LPTSTR lpCmdLine,int nShowCmd)
{
MessageBoxW(NULL,L"Hello world!",L"Title",MB_OK);
return 0;}
Compiling...
dsfk.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/dsfk.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.dsfk.exe - 1 error(s), 0 warning(s)
#include <tchar.h>
int WINAPI _tWinMain( HINSTANCE hInstance,HINSTANCE hPrewInstance,LPTSTR lpCmdLine,int nShowCmd)
{
MessageBoxW(NULL,L"Hello world!",L"Title",MB_OK);
return 0;}
Compiling...
dsfk.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/dsfk.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.dsfk.exe - 1 error(s), 0 warning(s)
改成WIN32项目或者改成
int _tmain(int argc, _TCHAR* argv[])
{
MessageBoxW(NULL,L"Hello world!",L"Title",MB_OK);
return 0;
}
FILE->NEW 选择win32 application 就行了。
#include <tchar.h>//最好在工程属性里改,加上下面这句也是可以的.
#pragma comment(linker, "/subsystem:windows")