I know this is quite a ridiculous question but this is quite confusing and irritating, as something that should work simply is not. I'm using Code Blocks with the GCC compiler and I am trying to simply create 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 find the class "string" which for some reason, my main.cpp is able to detect "#include " while my language class is not able for some reason.
This is the main I wrote quickly just to see it main itself is able to 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?