shaochuan / cmake-protobuf-example

Minimal example of using CMake to manage C++ project with protobuf.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libprotobuf fatal error when running output file

indrango opened this issue · comments

Thank you for creating example how to build protobuf via cmake, I have a problem when running the compiled file.

libprotobuf FATAL google/protobuf/generated_message_util.cc:783

Solution
Open CMakeLists.txt in the main folder, change
TARGET_LINK_LIBRARIES(main proto ${PROTOBUF_LIBRARY})
into
TARGET_LINK_LIBRARIES(main proto ${PROTOBUF_LIBRARIES})

Based CMake documentation
https://cmake.org/cmake/help/v3.0/module/FindProtobuf.html