这是一个图像处理类,用CArray定义了一个二维数组DoubleArray,该该类型在实现类中能正常使用,由于设计需要把它定义在头文件中,放在头文件函数的参数里就编译出错了;这个错误要怎样调整呢?
1>D:\Program Files\VisualStudio2005\VC\atlmfc\include\afxtempl.h(272) : error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject'
1>        D:\Program Files\VisualStudio2005\VC\atlmfc\include\afx.h(553) : see declaration of 'CObject::CObject'
1>        D:\Program Files\VisualStudio2005\VC\atlmfc\include\afx.h(524) : see declaration of 'CObject'
1>        This diagnostic occurred in the compiler generated function 'CArray<TYPE,ARG_TYPE>::CArray(const CArray<TYPE,ARG_TYPE> &)'
1>        with
1>        [
1>            TYPE=SingleArray,
1>            ARG_TYPE=SingleArray &
1>        ]
// ImageProcess.h: CImageProcess 的接口类#ifndef _CPROCESS_H
#define _CPROCESS_H#include <afxtempl.h>typedef   CArray<int,int&>   SingleArray;   
typedef   CArray<SingleArray,SingleArray&>   DoubleArray; class CImageProcess : public CObject
{
protected:
           ………………public:
CImageProcess();
~CImageProcess(); BYTE* CreateDib( int wid, int hei, int bits );
void SetDibParam( BYTE *pDib );
BOOL LoadBmp( const char * );
BOOL Draw( CDC* pDC );
void GT_Threshold( int x, int y, int Dx, int Dy, int thre, DoubleArray ppDibBits );//使用了自定义的数据类型DoubleArray
void Threshold_G( int *T_gray, int thre );
void GT( int x, int y, int Dx, int Dy, DoubleArray ppDibBits ); //使用了自定义的数据类型DoubleArray
};#endif //!_CPROCESS_H

解决方案 »

  1.   

    我的编译工具是VisualStudio2005,代码也拿到VC++6.0中编译过了,还是这个CArray的问题,定义在头文件中为什么会出错呢,该怎么修正呢
      

  2.   

    http://topic.csdn.net/t/20060117/08/4520428.html
      

  3.   

    typedef  CArray <int,int&>  SingleArray;  
    typedef  CArray <SingleArray,SingleArray&>  DoubleArray; 
    typedef  CArray <int,int&>  SingleArray;  
    typedef  CArray <SingleArray*,SingleArray*&>  DoubleArray; 
      

  4.   

    另外不建议用CArray,用STL的vector好了
      

  5.   

    这样错误更多了
    1>ImageDoc.cpp
    1>.\ImageDoc.cpp(85) : warning C4244: '=' : conversion from 'ULONGLONG' to 'DWORD', possible loss of data
    1>.\ImageDoc.cpp(267) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
    1>        D:\Program Files\VisualStudio2005\VC\atlmfc\include\afxtempl.h(272): could be 'CArray<TYPE,ARG_TYPE> &CArray<TYPE,ARG_TYPE>::operator =(const CArray<TYPE,ARG_TYPE> &)'
    1>        with
    1>        [
    1>            TYPE=int,
    1>            ARG_TYPE=int &
    1>        ]
    1>        while trying to match the argument list '(SingleArray, int)'
      

  6.   

    typedef  CArray <int,int>  SingleArray;