私はここにこのコードを持っています:
Main.cpp
#include "AStarPlanner.h"
#include <costmap_2d/costmap_2d.h>
int main(int argc, char** argv)
{
AStarPlanner planner = AStarPlanner(10,10,&costmap);
}
と私のクラス:
AStarPlanner.h
class AStarPlanner {
public:
AStarPlanner(int width, int height, const costmap_2d::Costmap2D* costmap);
virtual ~AStarPlanner();
AStarPlanner.cpp
#include "AStarPlanner.h"
using namespace std;
AStarPlanner::AStarPlanner(int width, int height, const costmap_2d::Costmap2D* costmap)
{
ROS_INFO("Planner Konstruktor");
width_ = width;
height_ = height;
costmap_ = costmap;
}
間違いは見当たりません。関数が定義され、私のmain.cppはクラスについて知っています。
CMakeList
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
rosbuild_add_library (robot_mover src/AStarPlanner.cpp )
rosbuild_add_executable(robot_mover src/main.cpp)
しかし、私はこのエラーを受け取ります:AStarPlanner ::〜AStarPlanner()
への未定義の参照'vtable for AStarPlanner'**
** undefined reference to