问题在代码后面。// A minimal Win32 Program#include "windows.h"LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM);char szWinName[]= "MyWin"; //Name of window classint WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode){
HWND hwnd;
MSG msg;
WNDCLASSEX wcl; //Define a window class.
wcl.cbSize = sizeof(WNDCLASSEX); wcl.hInstance=hThisInst; //handle to this instance
wcl.lpszClassName = szWinName; //window class name
wcl.lpfnWndProc = WindowFunc;
wcl.style = 0; //default style
wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION); //standard icon
wcl.hIconSm = LoadIcon(NULL,IDI_WINLOGO);
wcl.hCursor = LoadCursor(NULL, IDC_ARROW); wcl.lpszMenuName = NULL; // no menu
wcl.cbClsExtra = 0; // no extra information needed
wcl.cbWndExtra = 0; // no extra information needed //make the window background white.
wcl.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); //Register the window class
if(!RegisterClassEx(&wcl))

return();

//Now that a window class has been registered ,a window can be created
hwnd = CreateWindow (
szWinName,
"Windows 98 Code", 
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
HWND_DESKTOP,
NULL,
hThisInst,
NULL
); ShowWindow(hwnd, nWinMode);
UpdateWindow(hwnd);

//while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;} //WinMain()LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
这段代码用VC编译时出来了下面的错误:--------------------Configuration: hellowold - Win32 Debug--------------------
Compiling...
hellowold.cpp
C:\Documents and Settings\hello\桌面\hellowold.cpp(37) : error C2059: syntax error : ')'
Error executing cl.exe.hellowold.obj - 1 error(s), 0 warning(s)
请问这是什么问题?我检查过代码,并没有漏括号。

解决方案 »

  1.   

    晕 return用错了。解决了。
      

  2.   

    遇到新问题!--------------------Configuration: hellowold - Win32 Debug--------------------
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/hellowold.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.hellowold.exe - 2 error(s), 0 warning(s)
      

  3.   

    再次解决。晕。Link设置中把Project Options中的subsystem:console改成subsystem:windows 。google搜索的。
      

  4.   

    lz有自我解决问题的能力,以后就先自己去解决(查MSDN,google或baidu搜索一下)
    实在解决不了再问吧,对你的提高有帮助。