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.
Asked
Active
Viewed 7,998 times
8

Humble Debugger
- 4,439
- 11
- 39
- 56
2 Answers
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.)
-
1I was wondering how to change the Jamroot or site config / user config for this – Humble Debugger Aug 28 '13 at 11:16
-
4using gcc : c++11 : "g++" :
-std=c++11 ; – Jason Aug 28 '13 at 13:05 -
2Why would I call`bjam` rather than `b2`? Or rather, what's the significance of doing that? – einpoklum Jan 08 '17 at 23:29
-
1@einpoklum for any recent releases of boost they are identical. A duplicate executable named `bjam` is included for backward compatibility – Antoine Dahan Aug 03 '18 at 05:54
8
Added the following in Jamroot
<toolset>gcc:<cxxflags>-std=gnu++0x
<toolset>clang:<cxxflags>-std=c++11
Seems to be working

Humble Debugger
- 4,439
- 11
- 39
- 56