do get_ and set_ have to be used in conjunction?
-
In my header file, I'm using only get_dataSectionPtr and no set (its value is set in the constructor) and I get the following errors: c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(43) : error C2086: 'long AbfFileStruct::dataSectionPtr' : redefinition c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(21) : see declaration of 'AbfFileStruct::dataSectionPtr' AbfFileStruct.cpp(12) : error C2039: 'set_dataSectionPtr' : is not a member of 'AbfFileStruct' c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(15) : see declaration of 'AbfFileStruct' c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(43) : error C2086: 'long AbfFileStruct::dataSectionPtr' : redefinition c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(21) : see declaration of 'AbfFileStruct::dataSectionPtr' And the offending code seems to be this: public __gc class AbfFileStruct { public: //always need at least a FileStream to construct it AbfFileStruct(FileStream *); __property long get_dataSectionPtr() { return dataSectionPtr; } void PrintFileStruct(); private: long dataSectionPtr; }; //ENDCLASS Ideas?
-
In my header file, I'm using only get_dataSectionPtr and no set (its value is set in the constructor) and I get the following errors: c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(43) : error C2086: 'long AbfFileStruct::dataSectionPtr' : redefinition c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(21) : see declaration of 'AbfFileStruct::dataSectionPtr' AbfFileStruct.cpp(12) : error C2039: 'set_dataSectionPtr' : is not a member of 'AbfFileStruct' c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(15) : see declaration of 'AbfFileStruct' c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(43) : error C2086: 'long AbfFileStruct::dataSectionPtr' : redefinition c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(21) : see declaration of 'AbfFileStruct::dataSectionPtr' And the offending code seems to be this: public __gc class AbfFileStruct { public: //always need at least a FileStream to construct it AbfFileStruct(FileStream *); __property long get_dataSectionPtr() { return dataSectionPtr; } void PrintFileStruct(); private: long dataSectionPtr; }; //ENDCLASS Ideas?
-
In my header file, I'm using only get_dataSectionPtr and no set (its value is set in the constructor) and I get the following errors: c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(43) : error C2086: 'long AbfFileStruct::dataSectionPtr' : redefinition c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(21) : see declaration of 'AbfFileStruct::dataSectionPtr' AbfFileStruct.cpp(12) : error C2039: 'set_dataSectionPtr' : is not a member of 'AbfFileStruct' c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(15) : see declaration of 'AbfFileStruct' c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(43) : error C2086: 'long AbfFileStruct::dataSectionPtr' : redefinition c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(21) : see declaration of 'AbfFileStruct::dataSectionPtr' And the offending code seems to be this: public __gc class AbfFileStruct { public: //always need at least a FileStream to construct it AbfFileStruct(FileStream *); __property long get_dataSectionPtr() { return dataSectionPtr; } void PrintFileStruct(); private: long dataSectionPtr; }; //ENDCLASS Ideas?
The reason for this error is that your private member variable (dataSectionPtr) has the same name as your property. That's because from your get_ method, the compiler will generate a property dataSectionPtr. Just rename your private member variable, and your code will compile.