I have problems with using functional in g++. I compile with !g++ -o test test.cpp -std=c++11
and it does not give any errors and the program also runs fine. I use Syntastic to check any errors before compiling, and it gives me the following output.
This is my program test.cpp:
1 #include <functional>
2
3 using namespace std;
4
5 int f(int x){
6 return x;
7 }
8
9 void f2(function<int(int)> f){
10
11 }
12
13 int main(){
14 return 0;
15 }
The error is:
1 test.cpp|9 col 9 error| variable or field ‘f2’ declared void
2 test.cpp|9 col 9 error| ‘function’ was not declared in this scope
3 test.cpp|9 col 18 error| expected primary-expression before ‘int’
What does this error mean and how do I fix it?