【问题标题】:How do I convert a Makefile to a ROS CmakeList.txt如何将 Makefile 转换为 ROS CmakeList.txt
【发布时间】:2021-03-19 13:11:20
【问题描述】:

我有简单的 Makefile 来编译我的程序。 makefile 中的代码如下

#
INCLUDE_DIR = /usr/src/linux/include
CC = g++
CFLAGS = -Wall

OBJS = demo.o

all:$(OBJS)
    $(CC) $^ -o demo -lcsmc -pthread

clean:
    rm -f *.o demo

我正在尝试将其转换为 ROS CmakeList.txt,这就是我包含我的库的方式 find_library(csmc REQUIRED) 我的可执行文件称为 mover 当我运行 catkin_make 时,我得到了我的函数不存在的错误

mover.cpp:(.text+0x2f): undefined reference to `SmcWSetResolveSpeed'
mover.cpp:(.text+0x58): undefined reference to `SmcWGetErrorString'

如何解决这个问题,让我的catkin_make 成功运行。

【问题讨论】:

    标签: c++ makefile cmake ros


    【解决方案1】:

    我通过将find_library(csmc REQUIRED) 替换为target_link_libraries(mover csmc) 解决了这个问题

    【讨论】:

      【解决方案2】:

      您实际上是在寻求教程。没有好的魔法makefile -> cmake 文件程序。您只需学习 CMake。

      https://discourse.cmake.org/t/recommended-cmake-tutorials/2966

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-03-19
        • 2012-01-19
        • 2015-01-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多