1条回答 默认 最新
- 一百昏的小白 2021-06-22 15:08关注
问题未找到原因,但是可以直接忽略,使用Cmake编译生成可执行文件
CMakeList.txt
cmake_minimum_required(VERSION 3.5) PROJECT(bin) # Find required protobuf package find_package(Protobuf REQUIRED) if(PROTOBUF_FOUND) message(STATUS "protobuf library found") else() message(FATAL_ERROR "protobuf library is needed but cant be found") endif() include_directories(${PROTOBUF_INCLUDE_DIRS}) include_directories("/usr/include/") add_compile_options( -std=c++11 -O3 -Wall -c -fmessage-length=0 -fPIC -fPIE -pie -fstack-protector-all -Wtrampolines ) add_executable (proto_r Reader.cpp Mymessage.pb.cc) target_link_libraries(proto_r ${PROTOBUF_LIBRARIES} ) add_executable (proto_w Writer.cpp Mymessage.pb.cc) target_link_libraries(proto_w ${PROTOBUF_LIBRARIES} ) SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报