WebSocket++ uses a number of features of C++11 and its standard library. In all cases, these features can be replaced with equivalent functionality from the Boost libraries for use with C++03 compilers. By default, WebSocket++ will use the Boost variants of these features unless instructed otherwise. Starting in version 0.5.x WebSocket++ will automatically configure most C++11 settings when the compiler is building in C++11 mode. Prior versions (0.3.x and 0.4.x) may need to manually activate C++11 features.
WebSocket++ may attempt to enable some C++11 features on pre-C++11 compilers if it detects that they are available. The instructions below detail how to force C++11 features to be used (or not used) on such compilers. Generally, LLVM/Clang 3.4 and higher and GCC 4.7 and higher will build WebSocket++ in full C++11 mode with no special flags needed. Visual Studio 2010 and higher will build in a partial C++11 mode with no flags required either.
Notes for Visual Studio Users:
Visual Studio does not play well with the Boost functional library. As such it is recommended that users of Visual Studio 2010 and later enable the
<memory>C++11 headers via the methods described below even if they are not using other C++11 functionality. For library versions 0.5.x and higher this is done automatically. For older versions it must be done manually via preprocessor defines.
Second note: WebSocket++ using the C++11 functional header (as is recommended for all Visual Studio users) makes use of the variadic function
std::bindwith up to ~7 arguments. Visual Studio 2010 by default will fake variadics up to 10 arguments and 2012 up to 5 arguments. 2013 supports real variadics that do not have these very low argument limits. As such, Visual Studio 2012 users may need to increase the variadic expansion limit to at least 8. This can be done by defining
_VARIADIC_MAXto be at least 8 before the WebSocket++ (or the <functional> header) is included. Like with the functional library above, this is done automatically by library versions 0.5.x and higher but must be done manually for older versions.
Language features can be enabled by defining the
_WEBSOCKETPP_CPP11_STL_ preprocessor token before the library headers are included. Usually this is done in the build system itself but it can also be done in the code immediately before the declaration. Using the build system defines allows different settings on different build systems for more flexibility. C++11 features may be automatically enabled if WebSocket++ is able to confirm that a given feature is available.
Library features default to Boost variants unless
_WEBSOCKETPP_CPP11_STL_ is defined, C++11 support is automatically detected, or their appropriate individual token is defined. All library feature tokens have a second token of the form
_WEBSOCKETPP_NO_CPP11_XXX_ that will disable that library even if
_WEBSOCKETPP_CPP11_STL_ is defined or WebSocket++ would have automatically configured that library for your build system. This is useful for suppressing a specific library that you know you do not want to use or that your build system doesn't support. Suppressed libraries will fall back to their boost equivalents.
Recommended manual configuration for popular build systems (library versions pre-0.5.x)
|Toolset||Recommended configuration flags|
|Mac OS X 10.8, XCode 4.6 (clang++ LLVMv3.2)||
|Mac OS X 10.10, XCode 6.1 (clang++ LLVMv3.5)||
|Ubuntu 12.10, GCC 4.7||
|Ubuntu 14.04, GCC 4.8.2||
|Windows, Visual Studio 2010||
|Windows, Visual Studio 2012||
|Windows, Visual Studio 2013||