catkin_make时报错找不到custom include custom.h

参考:
https://answers.ros.org/question/195467/catkin-unable-to-include-custom-libraries/

报错内容:
/home/zhanghu/catkin_ws/src/map_img_proccess/src/map_img_load.cpp:1:26: fatal error: map_img_load.h: 没有那个文件或目录
 #include "map_img_load.h"

解决办法:

You should create a folder named include/ < name of package > / (include/proj_utils in your case) where you put all the header files (*.hpp) of the package.

Then the package that exports the library should have the following in the CMakeLists to be able to export the header files:

catkin_package(      INCLUDE_DIRS include     LIBRARIES map_img_load      )

include_directories(
   include
   ${catkin_INCLUDE_DIRS})

Then the other package should be able to see the header files as (you might have to run catkin_make or cmake first):

 #include <name_of_package/header_file.h>

完整的CMakeLists.txt:
--------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.3)
project(map_img_proccess)

find_package(catkin REQUIRED COMPONENTS
  roscpp
)

find_package(OpenCV REQUIRED)

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES map_img_load
#  CATKIN_DEPENDS roscpp
#  DEPENDS system_lib
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
)

add_library(map_img_load src/map_img_load.cpp)
target_link_libraries(map_img_load ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})

add_executable(main src/main.cpp)
target_link_libraries(main map_img_load ${catkin_LIBRARIES} )

--------------------------------------------------------------------------------------------

同时:头文件中有条件编译的千万别忘记最后的#endif
#ifndef ...
#define ...
...
...
#endif

原文地址:https://www.cnblogs.com/hiram-zhang/p/8495511.html

时间: 2024-08-07 22:45:18

catkin_make时报错找不到custom include custom.h的相关文章

java HelloWorld时报错:&quot;找不到或无法加载主类&quot;问题的解决办法

当我在做Java入门的时候,根据教程写的第一个Java程序是: public class HelloWorld { /* 第一个Java程序 * 它将打印字符串 Hello World */ public static void main(String []args) { System.out.println("Hello World"); // 打印 Hello World } } 这个文件的后缀是.java,然后使用cmd(命令提示符工具)在当前目录下键入:javac HelloW

Noesis.Javascript.dll 引用时报错“找不到指定的模块”

Could not load file or assembly 'Noesis.Javascript.dll' or one of its dependencies. 找不到指定的模块. 通过反编译发现了这个dll引用了“Microsoft.VisualC”,版本为10.0.0.0 下载安装“Microsoft Visual C++ 2010 可再发行组件包 (x86)”https://www.microsoft.com/zh-cn/download/details.aspx?id=5555 参

Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法

Laravel 5.4 Mix & Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法 首先进入package.json文件,将scripts下的所有cross-env删除掉,(devDependencies下的不能删除)处理结果代码如下: { "private": true, "scripts": { "dev": "npm run development&qu

解决ThinkPHP关闭调试模式时报错的问题汇总

解决ThinkPHP关闭调试模式时报错的问题汇总 案例一: 最近用ThinkPHP开发一个项目,本地开发测试完成上传到服务器后,第一次打开正常,再刷新页面时就出现 "页面调试错误,无法找开页面,请重试"的错误. 明明本地设置define('APP_DEBUG', false) 运行没点问题,怎么放到服务器上就出错了昵? baidu,Google还是没有找到解决方案,突然发现项目APP_Name/Runtime/Cache目录和APP_Name/Runtime/Logs目录没有可写权限,

win10下pip3安装tesserocr时报错

使用pip3在线安装tesserocr时报错,刚开始报错内容是提示未安装vs2014,安装完以后报错内容如下 ERROR: Command errored out with exit status 1: command: 'c:\users\administrator\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"

Mysql 插入时间时报错Incorrect datetime value: &#39;&#39; for column &#39;createtime&#39;

在网上找了很多方法总结如下: 1.MySQL驱动版本的问题.这种一般是在mYSQL版本更新了之后才会报错.解决方法在jdbc里添加"&useOldAliasMetadataBehavior=true" 2.可能是datetime的格式问题. datetime 以'YYYY-MM-DD HH:MM:SS'格式检索和显示DATETIME值.支持的范围为'1000-01-01 00:00:00'到'9999-12-31 23:59:59'TIMESTAMP值不能早于1970或晚于20

编译ndoutils-1.4b9时报错

[[email protected] ndoutils-1.4b9]# makecd ./src && makemake[1]: Entering directory `/nagios/ndoutils-1.4b9/src'gcc -fPIC -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H  -c -o io.o io.cIn file included from io.c:11:../include/config.h:261:25: e

app打包时报错unable to execute command: Segmentation fault: 11

问题:打包时报错   clang: error:unable to execute command: Segmentation fault: 11 clang: error:linker command failed due to signal (use -v to see invocation) app在上架的时候遇到这个报错问题,一开始以为是证书或者是配置描述文件哪里出错了.作为新手,在试了好多方法依然无法解决之后,只能无奈按照app上架流程又完完全全的重新过了一遍,在点击Archive后的

Eclipse启动时报错

Eclipse启动时报错:A Java RunTime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No java virtual machine was found after searching the following locations:- 此问题起于我在Ubuntu装了两个版本的eclipse:java8和java7:卸载前者后出现启动不了ecli