vector does not name a type

Sep 26, 2015 at 5:33pm
I don't why, but it doesn't recognize neither vector nor string....I think I must have some wrong configuration in my settings project, but I don't what it can be...does any one can help me?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

#include <stdio.h>
#include <string>
#include <tuple>
#include <iostream>
#include <vector>


struct Assoc{
	vector<pair<string,int>> vec;
	
	const int& operator[] (const string&) const;
	int& operator[](const string&);
};



int main(){
	
}

Last edited on Sep 26, 2015 at 5:34pm
Sep 26, 2015 at 5:38pm
Add on line 8:
1
2
3
using std::vector;
using std::string;
using std::pair;
Sep 26, 2015 at 5:43pm
that's true they belong to the standard library...I guess I could insert too
1
2

using namespace std;
Sep 28, 2015 at 9:23am
There is a rationale, why the language supports namespaces. I do suggest that you read first: http://www.gotw.ca/publications/migrating_to_namespaces.htm

Sep 28, 2015 at 4:31pm
Thanks, as my file was a simple .cpp I could use using directive but with more files, headers files and source files declare namespace explicitly in headers and use using directive in source files....thanks
Topic archived. No new replies allowed.