C++ Declaring strings for use within classes.

Discussion in 'Programming' started by pictureboarduk, Mar 3, 2009.

  1. #1
    Hi,

    If anyone can point out my mistake it would most appreciated. :)

    I am trying to use a string in a class, but Visual Studio seems not be be recognizing the datatype.

    I have main.cpp

    and this is the header file:

    Visual Studio turns the 'int' blue, so it recognises that, but not the string datatype.

    :confused:

    Thanks!
     
    pictureboarduk, Mar 3, 2009 IP
  2. aljosabre

    aljosabre Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well, it's normal for vs .. why do you use std namespace and then std::string ?
    But i think it should work either way (i presume) .. string name or std::string
     
    aljosabre, Mar 3, 2009 IP
  3. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #3
    int a_number ; missing .
     
    it career, Mar 3, 2009 IP
  4. fulllydisturbed

    fulllydisturbed Peon

    Messages:
    24
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ya ... itcareer is correct... "int a_number " ( " ; - missing ")

    the semicolon (termination) for declaration is missing...
     
    fulllydisturbed, Mar 3, 2009 IP