• ### Announcements

#### Archived

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

# Problem with VC++6 and strings...

## Recommended Posts

I cant seem to use the library with VC++6. I know this is probably something rediculously stupid, but I figured if there was any place to find someone to help me, it was here. Thanks in advance! --------- Krunk

##### Share on other sites
[cpp]
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char **argv)
{
string myString = "Hello";
cout << myString;
return 0;
}
[/cpp]

That should work.

##### Share on other sites
oops

  #include #include using namespace std;int main(int argc, char **argv){string myString = "Hello";cout << myString;return 0;}

That should work.

##### Share on other sites
I assume, for the purpose of this discussion, that you mean you can''t seem to use the STL string class.

1. Have you used it before? If not, you may have forgotten a necessary step to using it.

2. Did you include <string> instead of <string.h> The "new"-style headers (so far employed only by the STL) drop the .h extension.

3. Did you either import the string class (which is in the std namespace) or the entire std namespace into your project?
using namespace std;

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

• ### Forum Statistics

• Total Topics
627701
• Total Posts
2978705

• 21
• 14
• 12
• 10
• 12