【发布时间】:2018-09-28 06:41:11
【问题描述】:
我尝试使用以下方法添加路径:
export PATH=<myPath>
export CPPFLAGS='-I<myPath>'
我尝试使用 make -I=<myPath> 运行 make。但是make仍然看不到hpp文件。
CmakeLists:
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
rosbuild_genmsg()
rosbuild_gensrv()
rosbuild_add_executable(add_two_ints_server src/add_two_ints_server.cpp)
rosbuild_add_executable(add_two_ints_client src/add_two_ints_client.cpp)
rosbuild_add_executable(data_sender src/data_sender.cpp)
rosbuild_add_executable(data_listener src/data_listener.cpp)
rosbuild_add_executable(dds_transfer src/dds_transfer.cpp)
MakeFile:
include $(shell rospack find mk)/cmake.mk
【问题讨论】:
-
$PATH与此无关,-I不是有效的make选项。CPPFLAGS看起来是正确的方法,但它取决于你没有向我们展示的 makefile 的内容。 -
@Biffen,添加文件
-
您在寻找
make CPPFLAGS='-I<myPath>'吗? -
@tripleee,我正在尝试添加自己的路径来编译项目
-
@DR.zarigan 你正在使用 CMake。这根本不是一个 make 问题。使用 CMake 添加包含目录有据可查,互联网上有大量示例。
标签: cmake include-path