Thread: Strange error

  1. #1
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654

    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 01: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, 04:09 AM
  2. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02: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