Compile error.Please help me.
-
When I compile my cpp file,the following error occurs.I don't know the reason.I do not use memcpy in my program.And I comment almost all the codes in the cpp file , but the error remains.Please help me,thank you very much! d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(373) : error C2668: 'memcpy' : ambiguous call to overloaded function d:\microsoft visual studio\vc98\include\xlocmon(106) : while compiling class-template member function 'void __thiscall CArray::SetSize(in t,int)' dix
-
When I compile my cpp file,the following error occurs.I don't know the reason.I do not use memcpy in my program.And I comment almost all the codes in the cpp file , but the error remains.Please help me,thank you very much! d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(373) : error C2668: 'memcpy' : ambiguous call to overloaded function d:\microsoft visual studio\vc98\include\xlocmon(106) : while compiling class-template member function 'void __thiscall CArray::SetSize(in t,int)' dix
CArray obviously uses memcpy, seeing as it's in the mfc code that the error occurs. CArray is crap anyhow, read my series on vector and use that instead. I have no idea why you have managed to include to different files that both include a memcpy function. Do you have any using namespace statements floating around ? They have a habit of including stuff you didn't consider, because that's what you are asking for when you do it. Christian NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
-
When I compile my cpp file,the following error occurs.I don't know the reason.I do not use memcpy in my program.And I comment almost all the codes in the cpp file , but the error remains.Please help me,thank you very much! d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(373) : error C2668: 'memcpy' : ambiguous call to overloaded function d:\microsoft visual studio\vc98\include\xlocmon(106) : while compiling class-template member function 'void __thiscall CArray::SetSize(in t,int)' dix
-
CArray obviously uses memcpy, seeing as it's in the mfc code that the error occurs. CArray is crap anyhow, read my series on vector and use that instead. I have no idea why you have managed to include to different files that both include a memcpy function. Do you have any using namespace statements floating around ? They have a habit of including stuff you didn't consider, because that's what you are asking for when you do it. Christian NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
-
i think you use the function "SetSize" of the libary afxtempl.h the wrong way causes it to copy wrong memory... maybe your value is negative, your error is somewhere while using CArray. []D [] []D []
-
When I compile my cpp file,the following error occurs.I don't know the reason.I do not use memcpy in my program.And I comment almost all the codes in the cpp file , but the error remains.Please help me,thank you very much! d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(373) : error C2668: 'memcpy' : ambiguous call to overloaded function d:\microsoft visual studio\vc98\include\xlocmon(106) : while compiling class-template member function 'void __thiscall CArray::SetSize(in t,int)' dix
-
Its seems that the Object the CArray stores gaves the errors. Has it an sizeof-Operator? The memcpy call you find as described "afxtempl.h" (373). X| Or show little bit of code.:~ Try this @ home. (B&B)
-
Thank you for your reply. The CArray is used in another class and I have used that class many times,no problem. Could it be the problem of VC,or the settings of my project, or "stdafx.h",or namespace? I really need your help.
-
My experience is reading the error message carefully is 80% of resolving the problem. Memcpy (ofCArray) has a problem with copying the data-> What is in your Array? Try this @ home. (B&B)
-
I don't use the Array.It is used in some other class.I don't know what's in it. But that class has been compiles , and no error.
-
Thank you. In one of my c++ header file, i use #include #include And in the cpp file , i use #include #include using namespace std; Is that the reason? dix
Probably, but as you didn't check 'display this message as is', I can't really say. What are the names of the includes ? using namespace std is pretty much always a bad idea, but to get this sort of problem it's also likely you've included a non standard header like iostream.h and then elsewhere included the standard one ( iostream in this case ). Christian NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma