Reputation: 8008
When I try to compile this, I get the following error:
error: expected unqualified-id before ‘using’
I know, this was asked several times before, but I didn't find the answer. Usually they say that a semicolon is missing in one of the header files. But it's not the case now. And of course I use the -std=c++0x
flag
#include <iostream>
#include <string>
#include <vector>
template <typename T>
using stringpair = std::pair<std::string, T>;
int main (int argc, char* argv[]) {
return 0;
}
Upvotes: 2
Views: 555
Reputation: 76240
Your error is caused by the fact that template aliases with using
is a C++11 feature and your compiler does not support it. You should add the corresponding flags at compilation. Those most likely are:
-std=c++11
(at least for g++
and clang++
).
Otherwise your compiler does not support them yet. GCC supports them from 4.7.
Upvotes: 3