why I can't declaring a CArray object in a separate header file [modified]
-
Hello :) I have no problem declaring a CArray variable inside a class definition but as I have a separate file that I place all my typedefs inside it have tried to define a struct that has a CArray member but compiler says: Error 1 error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h 272 this was my code inside TypeDefs.H typedef struct tag_compliance_info { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CArray<POINT> aCompliance; //Oh I forgot this board filters <> signs } STRUCT_COMPLIANCE_INFO; How can I solve this?
modified on Friday, October 24, 2008 3:12 AM
-
use a Poiner CArray * or another object to substitute the CArray. is it really essential?
Greetings from Germany
Hi KarstenK :) , You mean there is no way? but why? there should be a reason. what other objects you mean? Thanks
-
Hi KarstenK :) , You mean there is no way? but why? there should be a reason. what other objects you mean? Thanks
-
You got me wrong. :~ I think the constructor of the CArray dont like it that way. Do you really need the CArray? What will be in it?
Greetings from Germany
I'm not sure I still clear but do you mean CArray constructor has written in away that can't be declared in a struct and other objects do not have this problem. I want to store an array of 2 long int so either
CArray<LONG,LONG>aMyarray
orCArray<POINT>aMyArray
Danke:rose: -
I'm not sure I still clear but do you mean CArray constructor has written in away that can't be declared in a struct and other objects do not have this problem. I want to store an array of 2 long int so either
CArray<LONG,LONG>aMyarray
orCArray<POINT>aMyArray
Danke:rose: -
Some constructors of the CArray aren't public (with good reason). or try typedef CArray<long,> CMyArray; struct { CMyArray m_array; }
Greetings from Germany
dose not work. I even tried to inherit my struct from CObject but since the problem is accessing private members not protected couldn't solve the problem! typedef struct tag_compliance_info: CObject { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CArray<POINT> aCompliance; } STRUCT_COMPLIANCE_INFO;
-
dose not work. I even tried to inherit my struct from CObject but since the problem is accessing private members not protected couldn't solve the problem! typedef struct tag_compliance_info: CObject { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CArray<POINT> aCompliance; } STRUCT_COMPLIANCE_INFO;
-
why havent you tried it like i posted it you? :~ And you NEED a Array because the is a lot and different count of points:confused:
Greetings from Germany
KarstenK wrote:
why havent you tried it like i posted it you? Unsure
Hello :) I did but as I said it dose not work. you typed ypedef CArray<long,> CMyArray; struct { CMyArray m_array; } but I think there are many typos in it so I typed typedef CArray<POINT> CMyArray; typedef struct tag_compliance_info { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CMyArray aCompliance; } STRUCT_COMPLIANCE_INFO; still I get Error 1 error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h 272
KarstenK wrote:
And you NEED a Array because the is a lot and different count of pointsConfused
Exactly :)
-
KarstenK wrote:
why havent you tried it like i posted it you? Unsure
Hello :) I did but as I said it dose not work. you typed ypedef CArray<long,> CMyArray; struct { CMyArray m_array; } but I think there are many typos in it so I typed typedef CArray<POINT> CMyArray; typedef struct tag_compliance_info { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CMyArray aCompliance; } STRUCT_COMPLIANCE_INFO; still I get Error 1 error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h 272
KarstenK wrote:
And you NEED a Array because the is a lot and different count of pointsConfused
Exactly :)
in VS2008 i could compile and link::cool: typedef CArray CMyArray; typedef struct tag_compliance_info { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CMyArray aCompliance; } STRUCT_COMPLIANCE_INFO; or must use a pointer CMyArray* paCompliance;
Greetings from Germany
-
in VS2008 i could compile and link::cool: typedef CArray CMyArray; typedef struct tag_compliance_info { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CMyArray aCompliance; } STRUCT_COMPLIANCE_INFO; or must use a pointer CMyArray* paCompliance;
Greetings from Germany
Well I use visual studio 2005 :(( danke anyway