Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Minor Problem With Included Files

This topic is 5946 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

According to this C++ book I''m reading, you can define includes like this: #include <string> Instead of like this: #include <string.h> But I can''t seem to use #include <string> with my VC++ 6.0 compiler. Does VC++ support it? Or is there some setting I''m missing.

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by Draxis
According to this C++ book I''m reading, you can define includes like this:
#include <string>
Instead of like this:
#include <string.h>

Those are completely different headers. <string.h> is the old C-style string manipulation header, containing functions like strlen, strncpy and so on. <string> is the new C++ Standard Template Library (STL) string class, std::string. Note the std:: prefix; this is a reference to the std namespace in which all STL constructs are defined. Here''s how you use it:
#include <string>
// option 1: use the unqualified symbol
std::string str1;
// option 2: import only the symbol you want
using std::string;
string str2;
// option 3: import the entire namespace
using namespace std;
string str3;

Look up namespace and the using keyword in MSDN.

I wanna work for Microsoft!
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!