如何開始使用Visual Studio 2010的tr1功能?對於更具體的情況,我需要std :: tr1 ::函數。我想包括#include <tr1/functional>
該報告爲缺失,而#include <functional>
包括罰款,但是當我設置:如何在Visual Studio 2010中使用tr1(tr1 :: function)?
std::tr1::function<void(void)> callback;
我得到:
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 ';'
如果我使用升壓,它工作得很好,但對於這個項目,因爲使用特定的框架,我需要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 ';'
'tr1'手段[技術報告1](http://en.wikipedia.org/wiki/C%2B%2B_Technical_Report_1),這是提出增加的C++標準的列表。一旦提案被接受,'tr1'的指定就會過時。 –
你有沒有'包括'? –
是的,我確實包括了它。 – Speed