[ADDENDUM 2/2/15] They fixed this super fast after my post, so this post now is for educational use.

I started playing with bii tonight, and I think it’s got a lot of potential. As part of finding my way around, I followed their well written tutorials. However, when attempting to build a C++11 project, I found an issue at least with one of their example projects (I built a non-c++11 project easily and with no errors). In their docs for building c++ projects, they give the following CMake example for activating c++11:

IF(APPLE) TARGET_COMPILE_OPTIONS( ${BII_BLOCK_TARGET} INTERFACE "-std=c++11 -stdlib=libc++") ELSEIF (WIN32 OR UNIX) TARGET_COMPILE_OPTIONS( ${BIT_BLOCK_TARGET} INTERFACE "-std=c++11") ENDIF(APPLE)

The problem with the specific example project I was using: json11 specifically is that it’s a non-trivial project, with a lot of various make and cmake files including one another. Editing the cmake file in the source directory kept being over written during compilation. I actually had to do a deep dive into the various cmake files. The error I kept getting was:

INFO: Processing changes... Building: cmake --build . [ 33%] Building CXX object lasote/json11/CMakeFiles/lasote_json11.dir/json11.cpp.o [ 66%] Building CXX object lasote/json11/CMakeFiles/lasote_json11.dir/cmake_dummy.cpp.o Linking CXX static library liblasote_json11.a /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: liblasote_json11.a(cmake_dummy.cpp.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: liblasote_json11.a(cmake_dummy.cpp.o) has no symbols [ 66%] Built target lasote_json11 [100%] Building CXX object examples/json11/CMakeFiles/examples_json11_test.dir/test.cpp.o error: invalid value 'c++11 -stdlib=libc++' in '-std=c++11 -stdlib=libc++' make[2]: *** [examples/json11/CMakeFiles/examples_json11_test.dir/test.cpp.o] Error 1 make[1]: *** [examples/json11/CMakeFiles/examples_json11_test.dir/all] Error 2 make: *** [all] Error 2 ERROR: Build failed

The offending compiler flags were: "-std=c++11 -stdlib=libc++"

What they needed to be was “-std=c++11″, or “-std=c++0x” should work equally well.

For this specific project, the files that required changing were:

/build/examples/json11/CMakeFiles/examples_json11_test.dir/flags.make /build/lasote/json11/CMakeFiles/lasote_json11.dir/flags.make

By changing them to “-std=c++11” (or “-std=c++0x”), I received a successful build and run:



nsardo$ bii cpp:build INFO: Processing changes... Building: cmake --build . [ 66%] Built target lasote_json11 [100%] Building CXX object examples/json11/CMakeFiles/examples_json11_test.dir/test.cpp.o Linking CXX executable /Users/nsardo/Desktop/biiproj/json11/bin/examples_json11_test [100%] Built target examples_json11_test nsardo$ ./examples_json11_test k1: v1 k3: ["a", 123, true, false, null] obj: {"k1": "v1", "k2": 42, "k3": ["a", 123, true, false, null]} [[1, 2], [10, 20], [100, 200]]

Hopefully if someone else runs into this, it will save them some time and frustration.

Happy Coding.