Q:编译库文件时报错/opt/ros/kinetic/lib/move_base/move_base: symbol lookup error: /home/xjl/deepDisk/ubuntu/fangzhen/AstarPlugin/devel/lib//libglobal_planner_lib.so: undefined symbol: _ZN5Astar7getPathER5PointS1_
A:CMakeLists中编译库时未完全添加所需的可执行文件
文件结构:
--fun
----include
------a.h
------b.h
----src
------a.cpp
------b.cpp
其中b.cpp中导入#include<a.h>
CMakeLists.txt:
cmake_minimum_required(VERSION 3.0.2)
project(global_plan)
add_compile_options(-std=c++11)
include_directories(include}
add_library(b_lib src/b.cpp src/a.cpp) ###正确写法
#add_library(b_lib src/b.cpp) ###错误写法写法,未编译a.cpp