我正在将我的项目从 mac os x (xcode) 转换为 windows (visual studio 2013)。
但是当我尝试使用 std::function 时遇到了问题。
作为一个例子,我宣布。
std::function<void()> processFunc;
但我收到几个错误:
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
在 XCode 上,我需要启用 c++11,但从我的研究中看到的 VS 2013 启用了 C++11。
我唯一的 C++ 包含是 iostream
我应该添加另一个包含吗?
最佳答案
相信您需要#include <functional>
在 VS。
关于xcode - 在 Visual Studio 2013 上使用 std::function<void>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29437092/