Click here to Skip to main content
11,802,762 members (73,961 online)
Rate this: bad
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 0:22am
Binu MD at 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
0 KrunalRohit 356
1 OriginalGriff 335
2 CPallini 270
3 F-ES Sitecore 270
4 Sergey Alexandrovich Kryukov 234
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,735
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web02 | 2.8.151002.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