Thread: Headers in Visual C++ 6.0

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    16

    Headers in Visual C++ 6.0

    Hi, I have recently started using Visual C++ 6.0 but I have a problem. I want to define a string so I added string.h to the headers directory and included it. The problem is that when I compile it, it still doesnt recognise string as an identifier.

    Please help me!

    Thankyou
    jon

  2. #2
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    use a modern compiler.
    Unless you have legacy code to maintain there's no reason to use a 10 year old clunker like VC6 which doesn't even implement the official standards.

  3. #3
    Bond sunnypalsingh's Avatar
    Join Date
    Oct 2005
    Posts
    162
    I hope u are doing something like this

    Code:
    #include<iostream>
    #include<string>
    using std::string;
    using std::cout;
    
    int main()
    {
    string name="Blah_ Blah";
    cout<<name;
    return 0;
    }

  4. #4
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    <string.h> This is the old C header that defines all the lovely string handling routines such as strcpy, strlen, etc... It is not the C++ header that defines the string object.

    <cstring> This is the newer version of the above header... again, it is not the C++ header defining the string object.

    <string> This is the C++ header that defines the string object. This is the header you want to use.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  5. #5
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    jonnyfb, you don't need to add string .h to the headers directory. The headers directory lets visual studio know where to look for headers, not which headers to look for. string.h will already be in one of the folders specified.

    jwenting is right, in that vc6 is ancient and crappy... time to move on (although it's not quite 10 yet, it was released in 99)
    Last edited by ChaosEngine; 03-26-2006 at 06:46 PM.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  6. #6
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    499
    I got VC6 1 year ago, and have never thought it was an old and clunky compiler until I switched to Mac and started using VC6. I even wrote a couple of games with VC6.

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    16
    Ah ok i think it was because I wasnt using this:


    using std::string;
    using std::cout;

    I'll try it and see,
    Thanks,

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM