读书人

Chap1Exa1.obj : error LNK2001: unre

发布时间: 2012-03-08 13:30:13 作者: rapoo

Chap1Exa1.obj : error LNK2001: unresolved external symbol "long __stdcall WndPro
C++报错。
编译环境:Windows xp sp3 + vc++ 6.0 简中 +Visual Assist X 10.6.1845.0
问题:1、Visual Assist X 无法识别部分函数。例如“HINSTANCE”“WNDCLASS”。
2、连接时候报错。
代码:

C/C++ code
#include <windows.h>LRESULT CALLBACK WndPro(HWND , UINT , WPARAM , LPARAM);int APIENTRY WinMain(HINSTANCE hInstance , HINSTANCE hPrevInstance ,                     LPSTR lpCmdLine, int nCmdShow){    WNDCLASS wndclass;    HWND hwnd;    MSG msg;    /****************************/    wndclass.style = CS_HREDRAW|CS_VREDRAW;    wndclass.lpfnWndProc = WndPro;    wndclass.cbClsExtra =0;    wndclass.cbWndExtra =0;    wndclass.hInstance = hInstance;    wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);    wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);    wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);    wndclass.lpszMenuName = NULL;    wndclass.lpszClassName = "Chap1Exa1";    if(!RegisterClass(&wndclass))        return FALSE;    hwnd = CreateWindow("Chap1Exa1","Chap1Exa1",WS_OVERLAPPEDWINDOW,        CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,        NULL,NULL,hInstance,NULL);    ShowWindow(hwnd,nCmdShow);    UpdateWindow(hwnd);    while (GetMessage(&msg,NULL,0,0))    {        TranslateMessage(&msg);        DispatchMessage(&msg);    }    return msg.wParam;}LRESULT CALLBACK WndProc(HWND hwnd, UINT message,                          WPARAM wParam,LPARAM lParam){    switch(message)    {    case WM_PAINT:        HDC hdc;        PAINTSTRUCT ps;        hdc = BeginPaint(hwnd,&ps);        TextOut(hdc,20,60,"The First Windows Application Showing Window",35);        EndPaint(hwnd,&ps);        return 0;    case WM_DESTROY:        PostQuitMessage(0);        return 0;    }    return DefWindowProc(hwnd,message,wParam,lParam);}


[解决办法]
LRESULT CALLBACK WndPro(
LRESULT CALLBACK WndProc(

读书人网 >C++

热点推荐