cannot convert parameter 1 from 'chesstruct chessboard::*' to 'chesstruct *'
问一下大家,这句错误什么意思啊,同样一个函数,在构造函数中调用没有问题,在成员函数中调用怎么就出错了呢?
全局变量中有:
typedef struct
{
char chesstate[15][15];
}chesstruct;extern void init_board(chesstruct* pchess);调用的函数是:
chesstruct chessobject;
init_board(&chessobject);
同样一个函数,在构造函数中调用没有问题,在成员函数中调用怎么就出错了呢?

解决方案 »

  1.   

    chessboard是什么?看看你init_board()函数的声明和定义?
     
      

  2.   

    chessboard是个类其实是
      class chessboard:public CFrameWnd
    {
    public:
           chessboard()
           {
              init_board(&chessobject); 
          }
          void gameover()
          {
             init_board(&chessobject); 
          }
    public:
           chesstruct chessobject;
    }
    typedef struct 

    char chesstate[15][15]; 
    }chesstruct; extern void init_board(chesstruct* pchess); 
      

  3.   

    it_board的定义:
    void init_board(chesstruct* pchess)
    {
    for (int i=0;i<=224;i++)
           pchess->chesstate[0][i]=0;
    }
      

  4.   

    把你类的chesstruct chessobject; 改个名字