Reputation: 1434
How does one start using the tr1 features of Visual Studio 2010? For a more specific case, I require the std::tr1::function. I tried including #include <tr1/functional>
which reports as missing, while #include <functional>
includes fine, but when I set this:
std::tr1::function<void(void)> callback;
I get:
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 ';'
If I use boost, it works fine, but for this project, because of using a specific framework I'd require the Visual Studio tr1 version.
As suggested, skipping the tr1, still returns the same result:
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 ';'
Upvotes: 8
Views: 4786
Reputation: 66912
Based on your comments, and on this page, I think that Marmalade comes with it's own STL implementation, that appears out of date. This page verifies that they use a version of STLPort, that does not support the TR1 that came out in 2005, much less anything newer. Your options are:
1) Copy/write those yourself
2) Do without
3) Download a newer version of STLPort. It doesn't seem to have been updated in the last two years, so no C++11, but they do mention having functional
, but aren't clear as to if it's in the std
or std::tr1
namespace. However, this might not work with Marmalade, so make backups and be careful.
Upvotes: 8