Results 1 to 3 of 3

Thread: Stupid Strings [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member GamerMax5's Avatar
    Join Date
    Nov 2004
    Location
    United States
    Posts
    388

    Resolved Stupid Strings [RESOLVED]

    I've always been baffled by this as I haven't paid much attention to it but now that I am, I'm reliving the irritability (is that a word?) of my past pains.

    Strings in C++...

    I've seen tutorials and books that say stuff like this as for the declaration of a string:

    Code:
    #include <string>
    
    string str1;
    Then I've seen this as an initialization for a string:

    Code:
    str1("Hello");
    str1 = "Hello";
    Now why is it I'm seeing this as examples from tutorials but when I do this in my code, all the time, I'll get this nice little error from the compiler (and I quote):

    'string' does not name a type
    This is a SECTION of code where the compiler complains:

    Code:
    typedef class item{
    private:
        ITEM_TYPE type;
        string name;  //right here!!!!!
        string desc;  //and here too!!!!
        int buyPrice;
        int sellPrice;
        BITMAP *sprite;
    Could someone tell me why this is happening? Thanks in advance
    Last edited by GamerMax5; Feb 1st, 2007 at 04:40 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width