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. How to fix compile error error C2535

How to fix compile error error C2535

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++visual-studiographics
2 Posts 2 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.
  • K Offline
    K Offline
    KASR1
    wrote on last edited by
    #1

    I am getting follwoing error when compiling in VS2010. The same code compiles in VC6. Any help on this?

    error C2535: 'bool std::binder2nd<_Fn2>::operator ()(const long &) const' : member function already defined or declared
    d:\program files\microsoft visual studio 10.0\vc\include\xfunctional 341 TestVect

    In Test.h file:

    struct VerifyAddressAtAllSlots:
    public binary_function
    {
    VerifyAddressAtAllSlots()
    {
    }
    const bool
    operator()(const long& thisAddress,
    const long& thatAddress) const
    {
    return true;
    }
    };

    In Test.cpp file:

    std::vector addrList;

    long verifyAddress = 0;

    for_each(addrList.begin(), addrList.end(), bind2nd(VerifyAddressAtAllSlots(), verifyAddress));

    C 1 Reply Last reply
    0
    • K KASR1

      I am getting follwoing error when compiling in VS2010. The same code compiles in VC6. Any help on this?

      error C2535: 'bool std::binder2nd<_Fn2>::operator ()(const long &) const' : member function already defined or declared
      d:\program files\microsoft visual studio 10.0\vc\include\xfunctional 341 TestVect

      In Test.h file:

      struct VerifyAddressAtAllSlots:
      public binary_function
      {
      VerifyAddressAtAllSlots()
      {
      }
      const bool
      operator()(const long& thisAddress,
      const long& thatAddress) const
      {
      return true;
      }
      };

      In Test.cpp file:

      std::vector addrList;

      long verifyAddress = 0;

      for_each(addrList.begin(), addrList.end(), bind2nd(VerifyAddressAtAllSlots(), verifyAddress));

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      Try making the operator inline:

      inline const bool
      operator()(const long& thisAddress,
      const long& thatAddress) const
      {
      return true;
      }

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<

      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