I have discovered something very interesting when it comes to STL in CodeBlocks for windows.
I compiled the following Hello World program and it runs just fine - code completion even worked for the vector that I used:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<string> test;
string myString = "Hello world in a vector!";
test.push_back(myString);
cout << test.at(0) << endl;
return 0;
}
But when I tried to do something similar in another source file i.e. for a class:
#ifndef TESTCLASS_H
#define TESTCLASS_H
#include <vector>
class testClass
{
vector<int> master_list;
public:
testClass();
protected:
private:
};
#endif // TESTCLASS_H
I get the following Error:
||=== Hello World++, Debug ===|
C:\Users\jhessin\Downloads\PortableApps\Projects\Hello World++\testclass.h|8|error: ISO C++ forbids declaration of `vector' with no type|
C:\Users\jhessin\Downloads\PortableApps\Projects\Hello World++\testclass.h|8|error: expected `;' before '<' token|
||=== Build finished: 2 errors, 0 warnings ===|
I have tried putting in #include <iostream>, but that does nothing. I don't know why but it seems that support for STL only goes as far as the main.cpp file.