I got some rather strange errors compiling code under gcc. He tells me that std::functiondoes not exist.
I can recreate the error with the following code:
#include <functional>
#include <stdio.h>
void test(){ printf ("test"); }
int main() {
std::function<void()> f;
f = test;
f();
}
If I ran gcc (from cygwin): (my error message was German, so I translated it. Maybe it is different from English gcc)
$ gcc test.cpp
test.cpp: in function "int main():
test.cpp:7:3: Error: "function" is not an element of "std"«
test.cpp:7:25: Error: "f" was not defined in this scope
With MSVC, it compiled successfully. Please tell me what I am doing wrong in my code.
Johannes
source
share