头文件中有没有加#include "stdafx.h"
如没有加上试试

解决方案 »

  1.   

    工程设置的C++页的 PreCompiled Header设为不使用
      

  2.   

    {这个我仔细检查了,没多没少
    原代码如下,大哥门检查以下
    /*************************************************************/
    //Define the moving matrix data
    int nchild_matrix3on[3][3]={{0,1,0},{0,1,1},{0,0,1}};
    int nchild_matrix3n[3][3]={{0,1,0},{1,1,0},{1,0,0}};
    int nchild_matrix3l[3][3]={{1,0,0},{1,0,0},{1,1,0}};
    int nchild_matrix3ol[3][3]={{0,0,1},{0,0,1},{0,1,1}};
    int nchild_matrix3t[3][3]={{1,1,1},{0,1,0},{0,1,0}};
    int nchild_matrix2d[2][2]={{1,1},{1,1}};
    int nchild_matrix4l[4][4]={{1,0,0,0},{1,0,0,0},{1,0,0,0},{1,0,0,0}};   //Define ChildMatrix struct
    struct childmatrix
    {
    int **pChild;
    int dimention;//judge matrix's dimention
    };childmatrix child_matrix[7]; //Define ChildMatrix Classclass ChildMatrix
    {
    public:
    childmatrix *pChildmatrix;
        
    public:
    ChildMatrix(childmatrix *pChildmatrix=NULL);
    childmatrix *SetChild(childmatrix *pChildmatrix=NULL);
    void InitData();
        void UnitMatrix(int** Matrix,childmatrix *pChildmatrix,int currentx,int currenty);
    BOOL IfCandown(int** Matrix,childmatrix *pChildmatrix,int currentx,int currenty);
    BOOL IfCanleft(int** Matrix,childmatrix *pChildmatrix,int currentx,int currenty);
    BOOL IfCanright(int** Matrix,childmatrix *pChildmatrix,int currentx,int currenty);
    BOOL IfCanRotate(int** Matrix,childmatrix *pChildmatrix,int currentx,int currenty);
        void RotateCldMtr(int** Matrix,childmatrix *pChildmatrix,int currentx,int currenty);
    void DelFullLine(int** Matrix,childmatrix *pChildmatrix);
    };
    #include "ChildMatrix.h"void ChildMatrix::InitData()
    {
    child_matrix[0].pChild =(int **)nchild_matrix3on;
    child_matrix[0].dimention=3; child_matrix[1].pChild=(int **)nchild_matrix3n;
    child_matrix[1].dimention=3; child_matrix[2].pChild = (int **)nchild_matrix3l;
    child_matrix[2].dimention=3; child_matrix[3].pChild=(int **)nchild_matrix3ol;
    child_matrix[3].dimention=3; child_matrix[4].pChild=(int **)nchild_matrix3t;
    child_matrix[4].dimention=3;

    child_matrix[5].pChild=(int **)nchild_matrix2d;
    child_matrix[5].dimention=2; child_matrix[6].pChild=(int **)nchild_matrix4l;
    child_matrix[6].dimention=4;
    }ChildMatrix::ChildMatrix(childmatrix *pChildmatrix=NULL)
    {
    this->pChildmatrix=pChildmateix;
    }void ChildMatrix::UnitMatrix(int **Matrix,childmatrix *pChildmatrix,int currentx,int currenty)
    {
    for(int i=0;i< pChildmatrix->dimention;i++)
    for(int j=0;j<pChildmatrix->dimention;j++)
    {
    if(currenty+pChildmatrix->dimention>19||currenty<0||currentx+i>29)
    break;
    else
    Matrix[currentx+i][currenty+j]=pChildmatrix->pChild[i][j];
    }
    }void ChildMatrix::RotateCldMtr(int **Matrix,childmatrix *pChildmatrix,int currentx,int currenty)
    {
    int i,j;
    for(i=0;i<pChildmatrix->dimention;i++) for(j=0;j<pChildmatrix->dimention;j++)
    {
    int temp=pChildmatrix->pChild[i][j];
    pChildmatrix->pChild[i][j]=pChildmatrix->pChild[j][pChildmatrix->dimention-i];
    pChildmatrix->pChild[j][pChildmatrix->dimention-i]=temp;
    }}BOOL ChildMatrix::IfCandown(int **Matrix,childmatrix *pChildmatrix,int currentx,int currenty)
    {
    int judge=0;
    int temp=pChildmatrix->dimention;
    for(int j=0;j<temp;j++)
    {
    if(currentx+temp-1<30)
    {
    if(!(Matrix[currentx+temp-1][currenty+j]&pChildmatrix->pChild[temp-1][j]))
       judge++;
    }
    if(pChildmatrix->pChild[temp-1][j]==0)
    judge++;
    }
    if(judge==temp)
    return true;
    else 
    return false;
    }BOOL ChildMatrix::IfCanleft(int **Matrix,childmatrix *pChildmatrix,int currentx,int currenty)
    {
    int judge=0;
    int temp=pChildmatrix->dimention;
    for(int i=0;i<temp;i++)
    {
    if(currenty>=0)
    {
    if(!(Matrix[currentx+i][currenty]&pChildmatrix->pChild[i][0]))
    judge++;
    }
    else
    if(pChildmatrix->pChild[i][0]==0)
    judge++;
            
    }
    if(judge==temp)
    return true;
    else
    return false;
    }BOOL ChildMatrix::IfCanright(int **Matrix,childmatrix *pChildmatrix,int currentx,int currenty)
    {
    int judge=0;
    int temp=pChildmatrix->dimention;
    for(int i=0;i<temp;i++)
    {
    if(currenty<20)
    {
    if(!(Matrix[currentx+i][currenty+temp-1]&pChildmatrix->pChild[i][temp-1]))
        judge++;
    }
    else
    if(pChildmatrix->pChild[i][temp-1]==0)
    judge++;
    }
    if(judge==temp)
    return true;
    else
    return false;
    }BOOL ChildMatrix::IfCanRotate(int **Matrix,childmatrix *pChildmatrix,int currentx,int currenty)
    {
    int judge=0;
    int tempy=currenty;
    int tempx=currentx;
    tempy=tempy? tempy:0;
    tempy=tempy>=20-pChildmatrix->dimention? (20-pChildmatrix->dimention):tempy;
    tempx=tempx>=30-pChildmatrix->dimention? (30-pChildmatrix->dimention):tempx;
    for(int i=0;i<pChildmatrix->dimention;i++)
    {
    for(int j=0;j<pChildmatrix->dimention;j++)
    if(Matrix[tempx+i][tempy+j]==0)
    judge++; } if(judge==pChildmatrix->dimention*pChildmatrix->dimention)
    return true;
    else
    return false;
    }void ChildMatrix::DelFullLine(int **Matrix,childmatrix *pChildmatrix)
    {
    int judge=0;
    for(int i=29;i>=0;)
    {
    for(int j=0;j<20;j++)
    {
    if(Matrix[i][j]==1)
    judge++;
    else
    break;
    }
    if(judge==20)
    {
    for(int l=i;l>=0;l--)
    for(int k=0;k<20;k++)
    Matrix[l][k]=Matrix[l-1][k];
    }
    else 
    i--;
    judge=0;
    }
    }childmatrix *ChildMatrix::SetChild(childmatrix *pChildmatrix=NULL)
    {
    this->pChildmatrix=pChildmatrix;
    return pChildmatrix;
    }
      

  3.   

    static int nchild_matrix3on[3][3]={{0,1,0},{0,1,1},{0,0,1}};
    static int nchild_matrix3n[3][3]={{0,1,0},{1,1,0},{1,0,0}};
    static int nchild_matrix3l[3][3]={{1,0,0},{1,0,0},{1,1,0}};
    static int nchild_matrix3ol[3][3]={{0,0,1},{0,0,1},{0,1,1}};
    static int nchild_matrix3t[3][3]={{1,1,1},{0,1,0},{0,1,0}};
    static int nchild_matrix2d[2][2]={{1,1},{1,1}};
    static int nchild_matrix4l[4][4]={{1,0,0,0},{1,0,0,0},{1,0,0,0},{1,0,0,0}};  
      

  4.   

    先直接编译EXE文件!
    说不定就没这错误了!!
    我就遇到过这情况!!
      

  5.   

    连预编译头文件都没搞清楚,建议先看看书再用VC++。
    先试试threads()的方法,不行就rebuild all,还不行就看书去!
      

  6.   

    你先把下面这句加到文件开头试试看
    #include "stdafx.h"
      

  7.   

    说得再确切一点,加到.cpp文件的第一行试试。
      

  8.   

    我也碰到过,加上
    #include "stdafx.h"
    就可以了