Hello! :)
I'm having some trouble including header files in my project. This is my three files:
main.cpp:
#include <iostream>
#include <string>
#include "functions.h"
using namespace std;
int main() {}
functions.h:
#include <iostream>
#include <string>
using namespace std;
void functionSplit(string str);
functions.cpp:
#include "functions.h"
using namespace std;
void functionSplit(string str)
{
vector<string> vec;
vec.push_back("");
vec.push_back("");
vec.push_back("");
int position = 0;
for (size_t i=0; i < str.length(); i++)
{
if (str[i] != '(' || str[i] != ')')
{
vec[position] +=str[i];
if (str[i] == ')')
position++;
}
}
vec[0].erase(vec[0].length()-1);
vec[0].erase(0,1);
cout << vec[0] << endl;
}
I know it isn't nessecary to include header files and all this stuff in this small project, but I just want to learn it.
These are the errors:
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(6) : error C2065: 'vector' : undeclared identifier
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(6) : error C2275: 'std::string' : illegal use of this type as an expression
1> c:\program files\microsoft visual studio 9.0\vc\include\xstring(2210) : see declaration of 'std::string'
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(6) : error C2065: 'vec' : undeclared identifier
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(7) : error C2065: 'vec' : undeclared identifier
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(7) : error C2228: left of '.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(8) : error C2065: 'vec' : undeclared identifier
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(8) : error C2228: left of '.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(9) : error C2065: 'vec' : undeclared identifier
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(9) : error C2228: left of '.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(16) : error C2065: 'vec' : undeclared identifier
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(21) : error C2065: 'vec' : undeclared identifier
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(21) : error C2228: left of '.erase' must have class/struct/union
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(21) : error C2065: 'vec' : undeclared identifier
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(21) : error C2228: left of '.length' must have class/struct/union
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(22) : error C2065: 'vec' : undeclared identifier
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(22) : error C2228: left of '.erase' must have class/struct/union
1>c:\users\arne\documents\visual studio 2008\projects\bank_project\bank_project\functions.cpp(23) : error C2065: 'vec' : undeclared identifier