I am writing a program using strings to pass messages into SDL functions. For some reason the compiler will not let me create any string objects though. I get a 'string' undeclared error when I try to compile this code:

#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include <string>

int errorMessage(int errorNumber)
{
...
      string::string error_message_string;
      string::string error_title;

Any suggestions? I am not using namespace std.

Recommended Answers

All 2 Replies

I am writing a program using strings to pass messages into SDL functions. For some reason the compiler will not let me create any string objects though. I get a 'string' undeclared error when I try to compile this code:

#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include <string>

int errorMessage(int errorNumber)
{
...
      string::string error_message_string;
      string::string error_title;

Any suggestions? I am not using namespace std.

Try changing string::string to std::string .

Oh dang yeah! Haha I knew that too! It's been one of those days... thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.