Spe*_*eed 8 c++ tr1 std visual-studio-2010 c++11
如何开始使用Visual Studio 2010的tr1功能?对于更具体的情况,我需要std :: tr1 :: function.我尝试将#include <tr1/functional>哪些报告#include <functional>包含在内,但包括罚款,但是当我设置这个时:
std::tr1::function<void(void)> callback;
Run Code Online (Sandbox Code Playgroud)
我明白了:
1>d:\marmalade\projects\core\src\button.h(21): error C3083: 'tr1': the symbol to the left of a '::' must be a type
1>d:\marmalade\projects\core\src\button.h(21): error C2039: 'function' : is not a member of '_STL'
1>d:\marmalade\projects\core\src\button.h(21): error C2143: syntax error : missing ';' before '<'
1>d:\marmalade\projects\core\src\button.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\marmalade\projects\core\src\button.h(21): error C2238: unexpected token(s) preceding ';'
Run Code Online (Sandbox Code Playgroud)
如果我使用boost,它工作正常,但对于这个项目,由于使用特定的框架,我需要Visual Studio tr1版本.
正如所建议的那样,跳过tr1仍会返回相同的结果:
std::function<void(void)> callback;
1>d:\marmalade\projects\core\src\button.h(20): error C2039: 'function' : is not a member of '_STL'
1>d:\marmalade\projects\core\src\button.h(20): error C2143: syntax error : missing ';' before '<'
1>d:\marmalade\projects\core\src\button.h(20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\marmalade\projects\core\src\button.h(20): error C2238: unexpected token(s) preceding ';'
Run Code Online (Sandbox Code Playgroud)
根据您的评论,在这个页面上,我认为Marmalade带有它自己的STL实现,它看起来已经过时了. 此页面验证他们使用的是STLPort版本,该版本不支持2005年推出的TR1,更不用说更新的版本了.你的选择是:
1)自己复制/写入
2)不要
3)下载更新版本的STLPort.它似乎在过去两年中没有更新过,所以没有C++ 11,但他们确实提到过functional,但不清楚它是否在std或std::tr1命名空间中.但是,这可能不适用于Marmalade,因此请进行备份并小心.