e:\program files\microsoft visual studio 8\vc\atlmfc\include\afxwin.h(259) : error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'
e:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h(540) : see declaration of 'CObject::operator ='
e:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h(510) : see declaration of 'CObject'
This diagnostic occurred in the compiler generated function 'CGdiObject &CGdiObject::operator =(const CGdiObject &)'
There is no reference to the line of code in my project that is provoking this error. The CPP file listed immediately before this error does not use in itself any GDI objects. I have tried compiling with various listings enabled to try to locate what is provoking the error but am making no progress.
Any ideas anyone

CGdiObject error C4482
Vinnie Tripodi
Hi,
Quickly browsing through sources, I do not see any code change that can cause this error. Could you show code snippet that causes this error Look for use of operator = in classes that subclass CGdiObject().
Thanks,
Nikola
VC++ Team
Devz
Thanks again.
B2
So, to recap. This was a MSVC6 project (still is, this is a test run at conversion / learning exercise) that compiled 100% ok under vc6 and vc8. I then added CLR support with a hand ful of errors (one with HTREEITEM) and this error + a 35MB debug executable. (The release build comes in under 3 mb normally). The IDE has bloated to 7-800MB during the compile...
Are there any switches to produce the expanded C++ code for this 1 file I tried some settings and one produced a 6+MB file that I searched for GDI objects in without success. The cpp file concerned is only a few hundred lines.
Ideas
Itzik Katzav
Could you please try separating this cpp file from the rest of the project and compile it Will it still give same errors
Is it possible if you email me this file Try zip it and email it to nikolad on microsoft dot com.
Thanks,
Nikola
klee310
Tim,
Look for similar pattern:
class CReproClass {CReproClass::CReproClass(void) {}CReproClass::~CReproClass(void) {}or
then is later used in
CReproClass a;
CReproClass b;
a = b;
This is the cause of your problem.
Thanks,
Nikola
Naras
I'll work towards that: add the file back in and try blocking code chunks until I find the offender & if that fails, pull out the cpp and do as you say.
- Tim