Click here to Skip to main content
11,925,896 members (64,538 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ MFC VisualC++
Hi to all. I have been trying to debug an application but it is giving me error only in debug
build. release build works fine. do i need to change some project settings or exclude some dlls?
i get the following debug output message in output window.

C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxtempl.h(262): error
C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject'

C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afx.h(535) : see
declaration of 'CObject::CObject'

C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afx.h(510) : see
declaration of 'CObject'

This diagnostic occurred in the compiler generated function
'CArray<type,arg_type>::CArray(const CArray<type,arg_type> &)'
Posted 12-Mar-13 1:22am
Binu MD 12-Mar-13 6:57am
please tell about the project settings that you were changed.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is a protection Smile | :) :
    CObject(const CObject& objectSrc);              // no implementation
...while the CArray class has not a copy constructor.

Why is it a "protection" ?
CArray do not know how its members must be copied, and CObject (base) as well... Smile | :)

So, for example, the code:
  CArray<CString>* pArray(new CArray<CString>);
  CArray<CString> arTest(*pArray);
  delete pArray;
  pArray = NULL;
  TCHAR tchTest(arTest[0].GetAt(1) + arTest[1].GetAt(2));
... may provide a crash at its last line Smile | :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 12 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100