注册 登录
编程论坛 C++教室

这个是什么样的错误? 怎样解决missing function header (old-style formal list?)

qinkai 发布于 2012-10-21 19:07, 622 次点击
#include <windows.h>
#include <stdio.h>
#include "stdafx.h"

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

int WINAPI WinMain(
                   HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR     lpCmdLine,
                   int       nCmdShow
                   )
{
    WNDCLASS   wndcls;
    wndcls.cbClsExtra=0;
    wndcls.cbClsExtra=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,
    UINT      uMsg,
    WPARAM    wParam,
    LPARAM    lParam
    );
{
    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);
        ReleaseDC(hwnd,hdc);
        TextOut(hdc,0,50,"计算机编程语言培训",strlen"计算机编程语言培训"));
        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,"是否真的结束?","Weinxin",MB_YESNO))
        {
            DestoryWindow(hwnd);
        }
        break;
    case WM_DESTORY:
        PostQuitMessage(0);
        break;
default;
    return DefWindowProc(hwnd,uMsg,wParam,lParam);
    }
    return 0;
}
4 回复
#2
pangding2012-10-27 10:41
你用的什么编译器?
说缺少的头文件是指 stdafx.h,old-style 就是这种加 .h 的。
#3
rjsp2012-10-27 10:43
LRESULT CALLBACK WinSunProc(
    HWND      hwnd,
    UINT      uMsg,
    WPARAM    wParam,
    LPARAM    lParam
    ); ------------------- 多了个分号
{

另外,如果你用#include "stdafx.h"这烂东西,你得把它放在最前面
#4
天剑山2012-10-27 14:48
这应该是没有头文件吧?长时间用Linux GNU编译器,完全不知道windows是怎么回事了......
#5
zxd5432012-10-27 17:51
missing function header (old-style formal list?)
你用谷歌翻译一下 应该就知道是什么错误了
头文件有问题
1