Error c2679

This is a discussion on Error c2679 within the C++ Programming forums, part of the General Programming Boards category; anyone knows how to fix this... Error 1 error C2679: binary '<<' : no operator found which takes a right-hand ...

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    30

    Arrow Error c2679

    anyone knows how to fix this...


    Error 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
    i couldnt figure out why it does this everytime i tried to do a simple cout on the pointer that carries the data

    Code:
    cout << ptr-> data
    it works on the memory add it holds but not the data.why? google seems didnt help much.
    ieven tried them but didnt work.

    any help would be much appreciated.
    Last edited by effa; 09-17-2009 at 03:17 PM. Reason: left out some info

  2. #2
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    478
    Try removing the space between -> and data.

    What type is data? You'll have to overload the << operator properly if it's a custom type, if I'm not mistaken.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    30
    hey i fix it! LOL..
    after all the hours i spent on this stupid error..i figure out how to solve it..

    i just need to change

    #
    Code:
    //my bad!
    
    #include <string.h>
    
    //urgh .not sure why but it works
    
    #include <string>

  4. #4
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    478
    Quote Originally Posted by effa View Post
    hey i fix it! LOL..
    after all the hours i spent on this stupid error..i figure out how to solve it..

    i just need to change

    #
    Code:
    //my bad!
    
    #include <string.h>
    
    //urgh .not sure why but it works
    
    #include <string>
    string.h is the C header for strings. Are you including iostream or iostream.h, by the way?
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21