I realise this is a silly question, but it's perplexing and annoying since something that should function isn't.
I'm using the GCC compiler with Code Blocks, and I'm trying to construct a string variable in my class.
#ifndef ALIEN_LANGUAGE
#define ALIEN_LANGUAGE
#include <string>
class Language
{
public:
private:
string str;
};
#endif
Strange enough, my compiler halts me with an error saying this:
C:\Documents and Settings\...|11|error: `string' does not name a type|
||=== Build finished: 1 errors, 0 warnings ===|
For some reason, it is unable to locate the class "string," despite the fact that my main.cpp is able to identify "#include," but my language class is not.
This is the essential point.
I wrote it hastily to check if the main programme could see the string file:
//main.cpp
#include <iostream>
#include <string>
#include "alien_language.h"
using namespace std;
int main()
{
string str;
return 0;
}
Does anyone know what's going on?