Strange error

This is a discussion on Strange error within the C++ Programming forums, part of the General Programming Boards category; I don't know if any of you have encountered anything such as this: Basically, I have a normal class, but ...

  1. #1
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,614

    Strange error (SOLVED)

    I don't know if any of you have encountered anything such as this:
    Basically, I have a normal class, but when I add...
    Code:
    CMap<UINT8, UINT8, UINT8, UINT8> m_Ids;
    ...to it, I get a load of compile errors:
    Code:
    3>afxtempl.h(1334) : error C2248: 'CObject::CObject' :
    			cannot access private member declared in class 'CObject'
    3>        afx.h(551) : see declaration of 'CObject::CObject'
    3>        afx.h(522) : see declaration of 'CObject'
    3>        This diagnostic occurred in the compiler generated function
    		'CMap<KEY,ARG_KEY,VALUE,ARG_VALUE>::CMap(const CMap<KEY,ARG_KEY,VALUE,ARG_VALUE> &)'
    3>        with
    3>        [
    3>            KEY=UINT8,
    3>            ARG_KEY=UINT8,
    3>            VALUE=UINT8,
    3>            ARG_VALUE=UINT8
    3>        ]
    Which is so weird. I don't understand why.
    The error occours in a compiler generated function to which there is no source, of course. I can comment out everything in the class, but it still won't work.
    I can change the types, but it still won't work.
    The only way I got it working is moving it to a different class.
    The class it's inside is not derived from anything.
    I find it weird, and I'm trying to hunt down the error. I'm guessing it's somehow related to its construction.
    If anyone has an idea, then I'd appreciate it.

    UPDATE: It's the copy constructor, as I suspected.
    Code:
    	//ERROR GetSetting(const CString& strKey, const CString& strName, CBuffer rBuffer, CBuffer rRetBuf = BufThrowError, CIndex::RegType* const pType = NULL) throw(...);
    Causes the error.
    Guess I'll have to overload a copy constructor to take care of this.
    But why oh why didn't the compiler point me to THAT LINE??????

    UPDATE2:
    Still working on the copy constructor, but having declared it is enough to remove the compile error.
    So enjoy yourselves reading this.
    Last edited by Elysia; 12-03-2007 at 12:53 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 03:09 AM
  2. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 09:33 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21