Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_cox
Beginner
343 Views

error: no operator "==" matches these operands

Here's another one that has me stumped

line 243 of ImagePsn.cpp says

POSITION pos = m_locList.Find( key ) ;

where CImagePosnInfoData key

and CList m_locList ;

but rather than invoking the CList's find function, it generates the following error

1>C:\\Program Files\\Microsoft Visual Studio 8\\VC\\atlmfc\\include\\afxtempl.h(161): error: no operator "==" matches these operands
1> operand types are: const CImagePosnInfoData == const CImagePosnInfoData
1> return *pElement1 == *pElement2;
1> ^
1> detected during:
1> instantiation of "BOOL={int} __stdcall CompareElements(const TYPE *, const ARG_TYPE *) [with TYPE=CImagePosnInfoData, ARG_TYPE=CImagePosnInfoData]" at line 1170
1> instantiation of "POSITION CList::Find(ARG_TYPE, POSITION) const [with TYPE=CImagePosnInfoData, ARG_TYPE=CImagePosnInfoData &]" at line 243 of "ImagePsn.cpp"
1>

So whats up? and what is the workaround?

Again this code has worked on other compilers

Thankx again

Jim

0 Kudos
3 Replies
JenniferJ
Moderator
343 Views

Hi Jim,

Thanks for your issue reporting.

I do see the error among so many other errors because the code is not selfcontained. I'll investigate more and see if I can find a work-around for you.

Will get back to you later.
Jennifer
jim_cox
Beginner
343 Views

Hi

Any progress on this?

I really do need a solution

Thankx

JenniferJ
Moderator
343 Views

It is a coding issue - you need to add the operator==.

CL also reports error too. CL didn't show the error with your original test is because other errors that stopped the compilation.

Using a simpler testcase attached, it shows the error for both icl and cl.

***** I'm having trouble to post code sample, please see the attachment t.cpp *****

You just need to overload "operator==".

Reply