Series
- Part 1: compile protobuf-cpp on ubuntu 16.04
- Part 2: compile protobuf-cpp on windows 10
- Part 3: protobuf usage
Guide
compile
1 | git clone https://github.com/protocolbuffers/protobuf.git |
with options
CMAKE_INSTALL_PREFIX C:/Program Files/protobuf
protobuf_BUILD_SHARED_LIBS ON
Static Linking vs DLL
Static linking
is now the default for the Protocol Buffer libraries. Due to issues with Win32’s use of a separate heap for each DLL, as well as binary compatibility issues between different versions of MSVC’s STL library, it is recommended that you use static linkage only.
However, it is possible to build libprotobuf and libprotoc as DLLs if you really want. To do this, do the following:
- Add an additional flag
-Dprotobuf_BUILD_SHARED_LIBS=ON
when invoking cmake - Follow the same steps as described in the above section.
- When compiling your project, make sure to
#define PROTOBUF_USE_DLLS
.
compile ALL_BUILD
with VS 2015
and install to C:/Program Files/protobuf
with dynamic libraries.
usage
1 | protoc --cpp_out=. ./point_cloud.proto |
CMakeLists.txt
1 | find_package(Protobuf REQUIRED) |
Reference
History
- 20181029: created.