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. C2664 error

C2664 error

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studiohelptutorialquestion
3 Posts 3 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.
  • S Offline
    S Offline
    subramanyeswari
    wrote on last edited by
    #1

    I am building legacy application in VS2008 solution. I have the followng lines in my code

    template <class MapType, class DestinationType = MapType::referent_type>
    class MapCopy
    {
    public :
    typedef DestinationType destination_type;
    typedef typename MapType::value_type source_type;
    static HRESULT copy(destination_type* pTo ,source_type *pFrom) //here i am getting C2664
    {
    }

    on building this project i am getting the following error error C2664: copy' : cannot convert parameter 2 from 'const std::pair<_Ty1,_Ty2> *' to 'std::pair<_Ty1,_Ty2> *' C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include\atlcom.h How to getrid of this error? Regards

    M A 2 Replies Last reply
    0
    • S subramanyeswari

      I am building legacy application in VS2008 solution. I have the followng lines in my code

      template <class MapType, class DestinationType = MapType::referent_type>
      class MapCopy
      {
      public :
      typedef DestinationType destination_type;
      typedef typename MapType::value_type source_type;
      static HRESULT copy(destination_type* pTo ,source_type *pFrom) //here i am getting C2664
      {
      }

      on building this project i am getting the following error error C2664: copy' : cannot convert parameter 2 from 'const std::pair<_Ty1,_Ty2> *' to 'std::pair<_Ty1,_Ty2> *' C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include\atlcom.h How to getrid of this error? Regards

      M Offline
      M Offline
      Madhu Nair 0
      wrote on last edited by
      #2

      subramanyeswari wrote:

      How to getrid of this error?

      Check this page for details on Compiler Error C2664[^] Possible solutions specified in MSDN 1. Recheck the prototype for the given function and correct the argument noted in the error message. 2. Supply an explicit conversion if necessary.

      1 Reply Last reply
      0
      • S subramanyeswari

        I am building legacy application in VS2008 solution. I have the followng lines in my code

        template <class MapType, class DestinationType = MapType::referent_type>
        class MapCopy
        {
        public :
        typedef DestinationType destination_type;
        typedef typename MapType::value_type source_type;
        static HRESULT copy(destination_type* pTo ,source_type *pFrom) //here i am getting C2664
        {
        }

        on building this project i am getting the following error error C2664: copy' : cannot convert parameter 2 from 'const std::pair<_Ty1,_Ty2> *' to 'std::pair<_Ty1,_Ty2> *' C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include\atlcom.h How to getrid of this error? Regards

        A Offline
        A Offline
        Andre_J
        wrote on last edited by
        #3

        Could it be as simple as adding the "const" declaration to the second type?

        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