Change boost.build jamfile for C++11 support?

2019-06-17 09:36发布

I have been using boost.build or b2 for building a project. I am trying to add C++11 contructs like auto and begin but the standard invokation b2 release in the directory with the Jamfile does not recognize these.

2条回答
孤傲高冷的网名
2楼-- · 2019-06-17 10:31

Added the following in Jamroot

 <toolset>gcc:<cxxflags>-std=gnu++0x
 <toolset>clang:<cxxflags>-std=c++11

Seems to be working

查看更多
做个烂人
3楼-- · 2019-06-17 10:32

You need to tell the compiler to enable c++11 support

For example, for gcc you can use

b2 toolset=gcc cxxflags="-std=c++11"

(or the same command with bjam instead of b2; they are identical these days with the bjam kept for backwards-compatibility.)

查看更多
登录 后发表回答