Help me!!!!! ..\Vc7\atlmfc\include\afxtempl.h(149) : error C2678: binary '==' : no operator found

  • Thread starter Thread starter IPD
  • Start date Start date
I

IPD

i build a project in VC++7.0, have so much error...:

D:\Program Files\Microsoft Visual Studio
..NET\Vc7\atlmfc\include\afxtempl.h(149): error C2678: binary '==' : no
operator found which takes a left-hand operand of type 'const
CSystemController' (or there is no acceptable conversion)
D:\Program Files\Microsoft Visual Studio
..NET\Vc7\atlmfc\include\afxtempl.h(149): error C2678: binary '==' : no
operator found which takes a left-hand operand of type 'const CInputDevice'
(or there is no acceptable conversion)
D:\Program Files\Microsoft Visual Studio
..NET\Vc7\atlmfc\include\afxtempl.h(149): error C2678: binary '==' : no
operator found which takes a left-hand operand of type 'const CLogicalDrive'
(or there is no acceptable conversion)
D:\Program Files\Microsoft Visual Studio
..NET\Vc7\atlmfc\include\afxtempl.h(149): error C2678: binary '==' : no
operator found which takes a left-hand operand of type 'const CMemorySlot'
(or there is no acceptable conversion)
D:\Program Files\Microsoft Visual Studio
..NET\Vc7\atlmfc\include\afxtempl.h(149): error C2678: binary '==' : no
operator found which takes a left-hand operand of type 'const CMonitor' (or
there is no acceptable conversion)
D:\Program Files\Microsoft Visual Studio
..NET\Vc7\atlmfc\include\afxtempl.h(149): error C2678: binary '==' : no
operator found which takes a left-hand operand of type 'const CModem' (or
there is no acceptable conversion)
D:\Program Files\Microsoft Visual Studio
..NET\Vc7\atlmfc\include\afxtempl.h(149): error C2678: binary '==' : no
operator found which takes a left-hand operand of type 'const
CNetworkAdapter' (or there is no acceptable conversion)
........

i have install Platform SDK, and change its include postion, but also
error...
Help me, Thank you....
 
IPD said:
i build a project in VC++7.0, have so much error...:

D:\Program Files\Microsoft Visual Studio
.NET\Vc7\atlmfc\include\afxtempl.h(149): error C2678: binary '==' : no
operator found which takes a left-hand operand of type 'const

[snip]

IPD:

Clearly your usage of the MFC collection classes requires you to define
operator == for your classes. Look in the Help for CompareElements().

As an aside I would strongly suggest use of the standard libraary
collection classes rather than the MFC ones.

David Wilkinson
 
Thank you, David Wilkinson!
Did your mean is, i don't use MFC 's library(like CArray), and use STL ?
This programe use so much CArray and other MFC library, midfy is hard! have
you other suggestion?
thank you again!


----- Original Message -----
From: "David Wilkinson" <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vc
Sent: Friday, November 10, 2006 6:40 PM
Subject: Re: Help me!!!!! ..\Vc7\atlmfc\include\afxtempl.h(149) : error
C2678: binary '==' : no operator found which takes a left-hand operand of
type 'const CVideoAdapter' (or there is no acceptable conversion)

IPD said:
i build a project in VC++7.0, have so much error...:

D:\Program Files\Microsoft Visual Studio
.NET\Vc7\atlmfc\include\afxtempl.h(149): error C2678: binary '==' : no
operator found which takes a left-hand operand of type 'const

[snip]

IPD:

Clearly your usage of the MFC collection classes requires you to define
operator == for your classes. Look in the Help for CompareElements().

As an aside I would strongly suggest use of the standard libraary
collection classes rather than the MFC ones.

David Wilkinson
 
IPD said:
Thank you, David Wilkinson!
Did your mean is, i don't use MFC 's library(like CArray), and use STL ?
This programe use so much CArray and other MFC library, midfy is hard! have
you other suggestion?
thank you again!

IPD:

I guess I am confused. If you have a lot of code using MFC collection
classes, has your code ever compiled correctly? Did you not get this
problem as soon as you added code containing the MFC collection classes
(before you had a lot of such usages)?

Anyway, as it is, it would seem that you need to define operator == for
your classes. Have you tried this?

This is really a separate issue, but I am not suggesting getting rid of
MFC, just the collection classes (CArray, CList, CMap...).

David Wilkinson
 
Back
Top