我来我网
https://5come5.cn
 
您尚未 登录  注册 | 菠菜 | 软件站 | 音乐站 | 邮箱1 | 邮箱2 | 风格选择 | 更多 » 
 

gary302025



性别: 帅哥 状态: 该用户目前不在线
头衔: 能屈能伸
等级: 赏金猎人
家族: Arsenal.com
发贴: 5170
威望: 5
浮云: 2783
在线等级:
注册时间: 2005-10-01
最后登陆: 2009-02-16

5come5帮你背单词 [ dispose /dis'pəuz/ v. 安排,处理 ]


vC++6.0的问题

为什么每次程序编译的时候没有错误,但是生成.exe文件的时候就有一个错误?跪求达人指教。

程序代码和错误报告在这里:

#include <windows.h>
#include <stdio.h>

LRESULT CALLBACK WinSunProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam  // second message parameter
);

int WINAPI WinMain(
  HINSTANCE hInstance,      // handle to current instance
  HINSTANCE hPrevInstance,  // handle to previous instance
  LPSTR lpCmdLine,          // command line
  int nCmdShow              // show state
)
{
    WNDCLASS wndcls;
    wndcls.cbClsExtra=0;
    wndcls.cbWndExtra=0;
    wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
    wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);
    wndcls.hIcon=LoadIcon(NULL,IDI_ERROR);
    wndcls.hInstance=hInstance;
    wndcls.lpfnWndProc=WinSunProc;
    wndcls.lpszClassName="Weixin2003";
    wndcls.lpszMenuName=NULL;
    wndcls.style=CS_HREDRAW | CS_VREDRAW;
    RegisterClass(&wndcls);

    HWND hwnd;
    hwnd=CreateWindow("Weixin2003","北京维新科学技术培训中心",WS_OVERLAPPEDWINDOW,
        0,0,600,400,NULL,NULL,hInstance,NULL);

    ShowWindow(hwnd,SW_SHOWNORMAL);
    UpdateWindow(hwnd);

    MSG msg;
    while(GetMessage(&msg,NULL,0,0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return 0;
}

LRESULT CALLBACK WinSunProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam  // second message parameter
)
{
    switch(uMsg)
    {
    case WM_CHAR:
        char szChar[20];
        sprintf(szChar,"char is %d",wParam);
        MessageBox(hwnd,szChar,"weixin",0);
        break;
    case WM_LBUTTONDOWN:
        MessageBox(hwnd,"mouse clicked","weixin",0);
        HDC hdc;
        hdc=GetDC(hwnd);
        TextOut(hdc,0,50,"计算机编程语言培训",strlen("计算机编程语言培训"));
        ReleaseDC(hwnd,hdc);
        break;
    case WM_PAINT:
        HDC hDC;
        PAINTSTRUCT ps;
        hDC=BeginPaint(hwnd,&ps);
        TextOut(hDC,0,0,"维新培训",strlen("维新培训"));
        EndPaint(hwnd,&ps);
        break;
    case WM_CLOSE:
        if(IDYES==MessageBox(hwnd,"是否真的结束?","weixin",MB_YESNO))
        {
            DestroyWindow(hwnd);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hwnd,uMsg,wParam,lParam);
    }
    return 0;
}


编译后没有错误:
--------------------Configuration: WinMain - Win32 Debug--------------------
Compiling...
Skipping... (no relevant changes detected)
WinMain.cpp

WinMain.obj - 0 error(s), 0 warning(s)



但是生成.exe的时候就有错误:
--------------------Configuration: WinMain - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/WinMain.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

WinMain.exe - 1 error(s), 0 warning(s)
顶端 Posted: 2008-04-10 12:58 | [楼 主]
眩枫九州





性别: 帅哥 状态: 该用户目前不在线
等级: 品行端正
发贴: 406
威望: 0
浮云: 1210
在线等级:
注册时间: 2007-11-29
最后登陆: 2009-03-21

5come5帮你背单词 [ luggage /'lΛgid3ə/ n. 行李 ]


换一台机子试一试呀!
顶端 Posted: 2008-04-10 13:19 | [1 楼]
我来我网·5come5 Forum » 程序员之家

Total 0.025823(s) query 8, Time now is:05-12 01:53, Gzip enabled
Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号