创建AppWizard(exe)后,在Proc.h中自定义的函数和Proc.cpp中总是出现上述错误,请教该怎么解决?

解决方案 »

  1.   

    程序如下:
    // filename  Proc.h
    #ifndef _INC_PROC
    #define _INC_PROC#include "dibapi.h"#endif //!_INC_DIBAPI#include "dibapi.h"
    #include <math.h>
    #include   <complex>   
    using   namespace   std; 
    #define PI (double) 3.14159265359
    void FHT(complex<double> *TD,complex<double> *FD,int power)
    {
    int count;
        int i,j,k,bfsize,p;
        double a;
        complex<double> *W,*X1,*X2,*X;
        count=1<<power;
        W=new complex<double>[count/2];
        X1=new complex<double>[count]; 
        X2=new complex<double>[count];
        for(i=0;i<count/2;i++)
    {
    a=-i*PI*2/count;
    W[i]=cos(a)+sin(a);
    }
    memcpy(X1,TD,sizeof(complex<double>)*count);
    for(k=0;k<power;k++)
    {
    for(j=0;j<1<<k;j++)
    {
    bfsize=1<<(power-k);
    for(i=0;i<bfsize/2;i++)
    {
    p=j*bfsize;
    X2[i+p]=X1[i+p]+X1[i+p+bfsize/2];
    X2[i+p+bfsize/2]=(X1[i+p]-X1[i+p+bfsize/2])*W[i*(1<<k)];
    }
    }
    X=X1;
    X1=X2;
    X2=X;
    }
    for(j=0;j<count;j++)
    {
    p=0;
    for(i=0;i<power;i++)
    {
    if(j&(1<<i))
    {
    p+=1<<(power-i-1);
    }
    FD[j]=X1[p];
    }
    free(W);
    free(X1);
    free(X2);
    }
    #define Point(x,y) lpPoints[(x)+(y)*nWidth]
    void GetPoints(int nWidth,int nHeight,BYTE *lpBits,BYTE *lpPoints)
    {
    int x,y,p;
    int nByteWidth=WIDTHBYTES(nWidth*8);
    for(y=0;y<nHeight;y++)
    {
    for(x=0;x<nWidth;x++)
    {
    p=3*x+y*nByteWidth;
    lpPoints[x+y*nWidth]=(BYTE)(0.299*(float)lpBits[p+2]+0.587*(float)lpBits[p+1]+0.144*(float)lpBits[p]+0.1);
    }
    }
    }
    void PutPoints(int nWidth,int nHeight,BYTE *lpBits,BYTE *lpPoints)
    {
    int x,y,p,p1;
    int nByteWidth=WIDTHBYTES(nWidth*8);
    for(y=0;y<nHeight;y++)
    {
    for(x=0;x<nWidth;x++)
    {
    p=3*x+y*nByteWidth;
    p1=x+y*nWidth;
    lpBits[p]=lpPoints[p1];
                lpBits[p+1]=lpPoints[p1];
                lpBits[p+2]=lpPoints[p1];
    }
    }
    }
    Compiling...
    Proc.cpp
    c:\documents and settings\gg\桌面\数字图像处理\mip2.0\mip2_0\proc.h(62) : error C2601: 'GetPoints' : local function definitions are illegal
    c:\documents and settings\gg\桌面\数字图像处理\mip2.0\mip2_0\proc.h(75) : error C2601: 'PutPoints' : local function definitions are illegal
    C:\Documents and Settings\gg\桌面\数字图像处理\mip2.0\mip2_0\Proc.cpp(10) : error C2601: 'ProcFunc' : local function definitions are illegal
    C:\Documents and Settings\gg\桌面\数字图像处理\mip2.0\mip2_0\Proc.cpp(126) : fatal error C1004: unexpected end of file found
    执行 cl.exe 时出错.mip.exe - 1 error(s), 0 warning(s)