Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Compile error.Please help me.

Compile error.Please help me.

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcsharpvisual-studio
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dix
    wrote on last edited by
    #1

    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

    C W K 3 Replies Last reply
    0
    • D 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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      D 1 Reply Last reply
      0
      • D 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

        W Offline
        W Offline
        Willem B
        wrote on last edited by
        #3

        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 []

        D 1 Reply Last reply
        0
        • C Christian Graus

          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

          D Offline
          D Offline
          dix
          wrote on last edited by
          #4

          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

          C 1 Reply Last reply
          0
          • W Willem B

            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 []

            D Offline
            D Offline
            dix
            wrote on last edited by
            #5

            I don't use CArray in the cpp file.I used it in some other class,and I include the header file.But there is no error when i compile that class. dix

            1 Reply Last reply
            0
            • D 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

              K Offline
              K Offline
              KarstenK
              wrote on last edited by
              #6

              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)

              D 1 Reply Last reply
              0
              • K KarstenK

                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)

                D Offline
                D Offline
                dix
                wrote on last edited by
                #7

                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.

                K 1 Reply Last reply
                0
                • D dix

                  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.

                  K Offline
                  K Offline
                  KarstenK
                  wrote on last edited by
                  #8

                  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)

                  D 1 Reply Last reply
                  0
                  • K KarstenK

                    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)

                    D Offline
                    D Offline
                    dix
                    wrote on last edited by
                    #9

                    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.

                    K 1 Reply Last reply
                    0
                    • D dix

                      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.

                      K Offline
                      K Offline
                      KarstenK
                      wrote on last edited by
                      #10

                      Now read that you use different namespaces. X| Have a lot of fun. Avoid this. Try this @ home. (B&B)

                      1 Reply Last reply
                      0
                      • D dix

                        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

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #11

                        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

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups