Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using std::function<void> on visual studio 2013

I am converting my project from mac os x (xcode) to windows (visual studio 2013). But i am having problems when i try to use the std::function. As an example i declared.

std::function<void()> processFunc;

But i get several errors:

Error   1   error C2039: 'function' : is not a member of 'std'  ...github\oglengine\engine\game.h   39  1   Engine
Error   2   error C2143: syntax error : missing ';' before '<'  ...github\oglengine\engine\game.h   39  1   Engine
Error   3   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   ...github\oglengine\engine\game.h   39  1   Engine

On XCode i needed to enable the c++11, but from what i saw on my research the VS 2013 have the C++11 enables.

My only C++ include is the iostream

Should i add another include?

like image 552
Lefsler Avatar asked Jan 08 '23 15:01

Lefsler


1 Answers

I believe you need to #include <functional> in VS.

like image 88
joeba Avatar answered Jan 20 '23 02:01

joeba