开发者

typedef in VC++ & boost

I'm learning about boost multiIndex and I'm following this tutorial.

The problem is that I cannot compile the code from the Hashed Indices section (the first block of code on that page) using Visual Studio 2008 :(

Every time I try, the c++ compiler complains:

main.cpp(19) : error C2143: syntax error : missing ';' before '<'
ma开发者_开发问答in.cpp(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Those errors occur at the typedef on line 19 in the block of code shown above. Can someone help me shed some light on this please?


The code in that example has an implied using directive -- using namespace boost::multi_index;.

Either add said using directive before the typedef, or fully qualify multi_index_container, indexed_by, ordered_unique, hashed_unique, etc.


Their code sample doesn't include the necessary namespaces, which I think is your problem. Try adding

using namespace boost;
using namespace boost::multi_index;

before the code given.


It's a namespace problem. You'll need a boost:: in front of that multi_index_container and indexed_by and everything else you're pulling from boost.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜