Change boost.build jamfile for C++11 support?
Asked Answered
Q

2

8

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.

Quadrireme answered 26/8, 2013 at 20:44 Comment(0)
Q
8

Added the following in Jamroot

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

Seems to be working

Quadrireme answered 4/11, 2013 at 18:10 Comment(0)
L
8

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.)

Lamoree answered 26/8, 2013 at 20:59 Comment(4)
I was wondering how to change the Jamroot or site config / user config for thisQuadrireme
using gcc : c++11 : "g++" : <cxxflags>-std=c++11 ;Lamoree
Why would I callbjam rather than b2? Or rather, what's the significance of doing that?Burgener
@Burgener for any recent releases of boost they are identical. A duplicate executable named bjam is included for backward compatibilityTransmundane
Q
8

Added the following in Jamroot

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

Seems to be working

Quadrireme answered 4/11, 2013 at 18:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.