xcode - 在 Visual Studio 2013 上使用 std::function<void>

标签 xcode c++11 visual-studio-2013 sfml

我正在将我的项目从 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/

相关文章:

xcode - 如何使用 cocoapods 保存源文件目录(或组)中的组织?

objective-c - Xcode - 在断言上调用堆栈跟踪?

c++ - Ref 限定的成员函数的目的是什么?

c++ - 我可以在构建新模板参数时使用一个可变模板参数吗?

c++ - 如何在重复循环中遍历 std::vector

javascript - 上传 cordova 包进行认证时出现验证错误

ios - 以编程方式更改 UISegmentedControl 选定的索引或值

ios - Flutter iOS 上每种 flavor 构建的不同 google maps api key

visual-studio - 每次从 TFS 获取最新代码时,文件都会被排除

internet-explorer - Visual Studio 2013 更新 1 启动 IE 时调试挂起