I try to compile some protocolbuffer files and I am getting the following errors:
[ 99%] Building CXX object CMakeFiles/lattice_planner.dir/modules/control/proto/lat_controller_conf.pb.cc.o
[100%] Linking CXX executable lattice_planner
CMakeFiles/lattice_planner.dir/modules/localization/proto/pose.pb.cc.o:(.bss+0x0): multiple definition of `apollo::localization::_Pose_default_instance_'
CMakeFiles/lattice_planner.dir/modules/common/localization/proto/pose.pb.cc.o:(.bss+0x0): first defined here
CMakeFiles/lattice_planner.dir/modules/localization/proto/pose.pb.cc.o: In function `apollo::localization::Pose::Pose()':
pose.pb.cc:(.text+0x4e8): multiple definition of `apollo::localization::Pose::Pose()'
CMakeFiles/lattice_planner.dir/modules/common/localization/proto/pose.pb.cc.o:pose.pb.cc:(.text+0x4e8): first defined here
The files are in different folders. Can I trick the compiler GCC 5.4.0 so that there are not multiple definitions? The CMakeLists.txt is quite huge because I added all source files by hand. Here are some code snippets:
cmake_minimum_required(VERSION 3.5)
project(lattice_planner_src)
set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -pthread")
find_package(Protobuf 3.7.1 REQUIRED)
if(PROTOBUF_FOUND)
message ("log: protobuf found")
else()
message (FATAL_ERROR "Cannot find Protobuf")
endif()
add_executable(lattice_planner apollo-planner-test-main.cpp ${SOURCE_FILES} ${HEADER_FILES} ${PTB_SRC} ${PTB_HDR})
while the PTB_SRC and PTB_HDR are the protobuffer sources and headers.
Aucun commentaire:
Enregistrer un commentaire