diff --git a/CMakeLists.txt b/CMakeLists.txt index 01ef89e60..34ebb80f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,8 @@ OPTION (MSGPACK_CXX11 "Using c++11 compiler" OFF) OPTION (MSGPACK_32BIT "32bit compile" OFF) OPTION (MSGPACK_BOOST "Using boost libraries" OFF) +SET (CMAKE_CXX_FLAGS "-DMSGPACK_DISABLE_LEGACY_NIL ${CMAKE_CXX_FLAGS}") + IF (APPLE) SET(CMAKE_MACOSX_RPATH ON) SET(CMAKE_SKIP_BUILD_RPATH FALSE) diff --git a/QUICKSTART-CPP.md b/QUICKSTART-CPP.md index 8261a95ad..29c1e2d6e 100644 --- a/QUICKSTART-CPP.md +++ b/QUICKSTART-CPP.md @@ -47,11 +47,13 @@ int main(void) { Compile it as follows: ``` -$ g++ hello.cc -o hello +$ g++ -Ipath_to_msgpack/include -DMSGPACK_DISABLE_LEGACY_NIL hello.cc -o hello $ ./hello ["Hello", "MessagePack"] ``` +See [MSGPACK_DISABLE_LEGACY_NIL](https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_configure#msgpack_disable_legacy_nil-since-140). + ## Streaming feature ```cpp @@ -83,7 +85,7 @@ int main(void) { } // results: - // $ g++ stream.cc -o stream + // $ g++ -Ipath_to_msgpack/include -DMSGPACK_DISABLE_LEGACY_NIL stream.cc -o stream // $ ./stream // "Log message ... 1" // "Log message ... 2" @@ -91,6 +93,8 @@ int main(void) { } ``` +See [MSGPACK_DISABLE_LEGACY_NIL](https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_configure#msgpack_disable_legacy_nil-since-140). + ### Streaming into an array or map ```cpp diff --git a/README.md b/README.md index ab489263e..a202e78ed 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,9 @@ Usage When you use msgpack on C++03 and C++11, you can just add msgpack-c/include to your include path: - g++ -I msgpack-c/include your_source_file.cpp + g++ -I msgpack-c/include -DMSGPACK_DISABLE_LEGACY_NIL your_source_file.cpp + +See [MSGPACK_DISABLE_LEGACY_NIL](https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_configure#msgpack_disable_legacy_nil-since-140). If you want to use C version of msgpack, you need to build it. You can also install the C and C++ versions of msgpack. diff --git a/test/Makefile.am b/test/Makefile.am index 5f451d025..35aa4b655 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/include -pthread +AM_CPPFLAGS = -I$(top_srcdir)/include -pthread -DMSGPACK_DISABLE_LEGACY_NIL AM_C_CPPFLAGS = -I$(top_srcdir)/include -pthread AM_LDFLAGS = $(top_builddir)/src/libmsgpackc.la -lgtest_main -lgtest -lpthread