这个哪出错了呢?

矫情狗_____ 矫情狗_____ 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include <windows.h>
#include <tchar.h>

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wndclass;
wndclass.lpfnWndProc = WindowProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpszClassName = _T("我的窗体");
wndclass.hInstance = hInstance;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hIcon = 0;
wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wndclass.lpszMenuName = 0;

if(RegisterClass(&wndclass) == 0)
{
MessageBox(0, _T("错误"), _T("错误"), MB_OK);
return 0;
}
HWND hWnd = CreateWindow(_T("我的窗体"), _T("第一个窗体"), WS_OVERLAPPEDWINDOW, 0, 0, 200, 300, 0, 0, hInstance, 0);
if(hWnd == NULL)
{
MessageBox(0, _T("失败"), _T("失败"), MB_OK);
return 0;
}
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
MSG msg;
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_CLOSE:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
return 0;
}

--------------------Configuration: API_01 - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/API_01.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

API_01.exe - 1 error(s), 0 warning(s)
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
矫情狗_____
VC/MFC 16,550 成员 421,606 内容