Archived

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

KrunkSplein

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 this post


Link to post
Share on other sites
Guest Anonymous Poster
[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 this post


Link to post
Share on other sites
Guest Anonymous Poster
oops

  
#include <iostream>
#include <string>

using namespace std;

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


That should work.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites