| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 495 人关注过本帖
标题:一个链接错误!!!求助
只看楼主 加入收藏
zhangqiliyan
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2009-2-17
结帖率:100%
收藏
 问题点数:0 回复次数:1 
一个链接错误!!!求助
照敲得一个程序:

#include<windows.h>
#include<stdio.h>
LRESULT CALLBACK WinSunProc(
    HWND hwnd,
    UINT uMsg,
    WPARAM  wParam,
    LPARAM  Iparam
);
int WINAPI  WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevinstance,
    LPSTR IpCmdLine,
    int nCmdShow
    )
    {
    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="sunxin2009";
    wndcls.lpszMenuName=NULL;
    wndcls.style=CS_HREDRAW | CS_VREDRAW;
    RegisterClass(&wndcls);
    HWND hwnd;
    hwnd=CreateWindow("sunxin2009","http://www.,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,
    UINT  uMsg,
    WPARAM wParam,
    WPARAM IParam
    )
{
    switch(uMsg)
    {
    case WM_CHAR:
        char szchar[20];
        sprintf(szchar,"char code is %d",wParam);
        MessageBox(hwnd,szchar,"char",0);
        break;
    case  WM_LBUTTONDOWN:
        MessageBox(hwnd,"mouse clicked","message",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,"http://www.,strlen("http://www.));
        EndPaint(hwnd,&ps);
        break;
    case  WM_CLOSE:
        if(IDYES==MessageBox(hwnd,"是否真的结束?","message",MB_YESNO))
        {
            DestroyWindow(hwnd);
        }
        break;
    case  WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
    return  DefWindowProc(hwnd,uMsg,wParam,IParam);
    }
    return 0;
}

运行时总报错:

Linking...
winmain1.obj : error LNK2001: unresolved external symbol "long __stdcall WinSunProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WinSunProc@@YGJPAUHWND__@@IIJ@Z)
Debug/winmain1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

winmain1.exe - 2 error(s), 0 warning(s)
网上搜的解决方案没一个可行!!!为什么啊???
搜索更多相关主题的帖子: 链接 
2009-10-21 15:48
zhangqiliyan
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2009-2-17
收藏
得分:0 
困惑啊   ~·~    这到底是怎么回事呢   没高手回啊
2009-10-21 17:16
快速回复:一个链接错误!!!求助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.136142 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved