简体   繁体   English

使用 ROS 和 cmake 正确链接库

[英]Link library correct with ROS and cmake

I'm trying to add use some code for a MOXA I/O Ethernet module with ROS.我正在尝试为带有 ROS 的 MOXA I/O 以太网模块添加一些代码。 I'm using some example code, to ensure it works.我正在使用一些示例代码,以确保它有效。 I have compiled the code with gcc, so I know the code works.我已经用 gcc 编译了代码,所以我知道代码可以工作。 I compiled it from a terminal with this line:我用这一行从终端编译它:

g++ -L/usr/lib/x86_64-linux-gnu -pthread main.cpp -Wall -O3 -omain_test -L/usr/local/lib -lmxio_x64 g++ -L/usr/lib/x86_64-linux-gnu -pthread main.cpp -Wall -O3 -omain_test -L/usr/local/lib -lmxio_x64

I get the main_test.out and it works.我得到了 main_test.out 并且它有效。

So I created a catkin workspace and a new package by following the ROS tutorial.所以我按照 ROS 教程创建了一个 catkin 工作区和一个新包。 I add my code to the src folder, edits the CMakeList and the package.xml.我将代码添加到 src 文件夹,编辑 CMakeList 和 package.xml。 Then when I try to run catkin_make -Wall (to get rid of a lot of warnings), I get the following message:然后,当我尝试运行 catkin_make -Wall (以消除很多警告)时,我收到以下消息:

Base path: /home/johau/ros_ws
Source space: /home/johau/ros_ws/src
Build space: /home/johau/ros_ws/build
Devel space: /home/johau/ros_ws/devel
Install space: /home/johau/ros_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/johau/ros_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/johau/ros_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/johau/ros_ws/devel;/opt/ros/indigo
-- This workspace overlays: /home/johau/ros_ws/devel;/opt/ros/indigo
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/johau/ros_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.9
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - master
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'master'
-- ==> add_subdirectory(master)
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   thread
-- Configuring done
-- Generating done
-- Build files have been written to: /home/johau/ros_ws/build
####
#### Running command: "make -Wall -j8 -l8" in "/home/johau/ros_ws/build"
####
Linking CXX executable /home/johau/ros_ws/devel/lib/master/main
CMakeFiles/main.dir/src/main.cpp.o: In function `main':
main.cpp:(.text+0xdd0): warning: the `gets' function is dangerous and should not be used.
/usr/local/lib/libmxio_x64.so: undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/johau/ros_ws/devel/lib/master/main] Error 1
make[1]: *** [master/CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

I also got the "undefined reference to 'phread_create'" when I compiled with gcc, and solved that problem by calling -pthread before main.cpp.当我使用 gcc 编译时,我还得到了“对 'phread_create' 的未定义引用”,并通过在 main.cpp 之前调用 -pthread 解决了这个问题。 So my problem now is, how can I do the same with CMake?所以我现在的问题是,我怎样才能对 CMake 做同样的事情? I have searched a lot and tried different solutions, but nothing have worked so far.我进行了很多搜索并尝试了不同的解决方案,但到目前为止没有任何效果。 I'm pretty green, when it comes to ROS and CMake, so I'm not sure what to add where, or if I have written something wrong somewhere in my CMakeLists.txt or package.xml.当谈到 ROS 和 CMake 时,我是非常绿色的,所以我不确定在哪里添加什么,或者我是否在我的 CMakeLists.txt 或 package.xml 的某个地方写错了东西。

I'm using Ubuntu 14.04 LTS and ROS Indigo.我正在使用 Ubuntu 14.04 LTS 和 ROS Indigo。 If you need anymore info, let my know.如果您需要更多信息,请告诉我。

On before hand, thanks.在手之前,谢谢。

[EDIT 1] I have now tried adding [编辑 1] 我现在尝试添加

set(CMAKE_CXX_FLAGS "-lpthread")设置(CMAKE_CXX_FLAGS“-lpthread”)

After project(master) in the CMakeLists.txt.在 CMakeLists.txt 中的项目(主)之后。 I also tried with:我也尝试过:

set(CMAKE_CXX_FLAGS "-L/usr/lib/x86_64-linux-gnu -pthread")设置(CMAKE_CXX_FLAGS“-L/usr/lib/x86_64-linux-gnu -pthread”)

and

set(CMAKE_CXX_FLAGS "-L/usr/lib/x86_64-linux-gnu")
set(CMAKE_CXX_FLAGS "-pthread")

But it gave the same error message.但它给出了同样的错误信息。

My CMakeLists.txt:我的 CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(master)

unset(MOXA_LIBRARY CACHE)

find_library(
   MOXA_LIBRARY
   NAMES mxio_x64
   PATHS /usr/local/lib
   PATH_SUFFIXES lib
   NO_DEFAULT_PATH
)

if(MOXA_LIBRARY STREQUAL "MOXA_LIBRARY-NOTFOUND")
    message(WARNING "Moxa Library not present !")
else()
    add_definitions(-DUSE_MOXA)
endif()

find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
)

## System dependencies are found with CMake's conventions
 find_package(Boost REQUIRED COMPONENTS thread)

###################################
## catkin specific configuration ##
###################################

catkin_package(
   CATKIN_DEPENDS roscpp std_msgs
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
  ${catkin_INCLUDE_DIRS}
  /usr/lib/x86_64-linux-gnu/
)

## Declare a cpp executable
 add_executable(main
     src/main.cpp)

## Specify libraries to link a library or executable target against
 target_link_libraries(main
   ${MOXA_LIBRARY}
   ${catkin_LIBRARIES}
   ${CMAKE_THREAD_LIBS_INIT}
 )

My package.xml:我的 package.xml:

<?xml version="1.0"?>
<package>
  <name>master</name>
  <version>0.0.0</version>
  <description>The master package</description>

  <maintainer email="johau@todo.todo">johau</maintainer>

  <license>BSD</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>std_msgs</run_depend>


  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- You can specify that this package is a metapackage here: -->
    <!-- <metapackage/> -->

    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

[EDIT 2] After request from @Lu-Niu did I run catkin_make VERBOSE=1 (catkin_make should be the same as the make command, as far as I know, the catkin part is just because it's within ROS) and the output is in the box bellow. [编辑 2] 在@Lu-Niu 的请求后,我是否运行catkin_make VERBOSE=1 (catkin_make 应该与 make 命令相同,据我所知,catkin 部分只是因为它在 ROS 中)并且输出在下面的方框。 As far, as I can see, so is -pthread specified, while I think it should be -lpthread, when the directory isn't specified first (correct me, if I'm wrong).据我所见,指定了-pthread,而我认为它应该是-lpthread,当没有首先指定目录时(纠正我,如果我错了)。 So what should I edit, to change the order of the command?那么我应该编辑什么来更改命令的顺序?

Base path: /home/johau/ros_ws
Source space: /home/johau/ros_ws/src
Build space: /home/johau/ros_ws/build
Devel space: /home/johau/ros_ws/devel
Install space: /home/johau/ros_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/johau/ros_ws/build"
####
####
#### Running command: "make VERBOSE=1 -j8 -l8" in "/home/johau/ros_ws/build"
####
/usr/bin/cmake -H/home/johau/ros_ws/src -B/home/johau/ros_ws/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/johau/ros_ws/build/CMakeFiles /home/johau/ros_ws/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/johau/ros_ws/build'
make -f master/CMakeFiles/main.dir/build.make master/CMakeFiles/main.dir/depend
make[2]: Entering directory `/home/johau/ros_ws/build'
cd /home/johau/ros_ws/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/johau/ros_ws/src /home/johau/ros_ws/src/master /home/johau/ros_ws/build /home/johau/ros_ws/build/master /home/johau/ros_ws/build/master/CMakeFiles/main.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/johau/ros_ws/build'
make -f master/CMakeFiles/main.dir/build.make master/CMakeFiles/main.dir/build
make[2]: Entering directory `/home/johau/ros_ws/build'
Linking CXX executable /home/johau/ros_ws/devel/lib/master/main
cd /home/johau/ros_ws/build/master && /usr/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/usr/bin/c++   -lpthread    CMakeFiles/main.dir/src/main.cpp.o  -o /home/johau/ros_ws/devel/lib/master/main  -L/usr/local/lib -rdynamic -lmxio_x64 /opt/ros/indigo/lib/libroscpp.so -lboost_signals -lboost_filesystem /opt/ros/indigo/lib/librosconsole.so /opt/ros/indigo/lib/librosconsole_log4cxx.so /opt/ros/indigo/lib/librosconsole_backend_interface.so -llog4cxx -lboost_regex /opt/ros/indigo/lib/libxmlrpcpp.so /opt/ros/indigo/lib/libroscpp_serialization.so /opt/ros/indigo/lib/librostime.so -lboost_date_time /opt/ros/indigo/lib/libcpp_common.so -lboost_system -lboost_thread -lpthread -lconsole_bridge -Wl,-rpath,/usr/local/lib:/opt/ros/indigo/lib 
CMakeFiles/main.dir/src/main.cpp.o: In function `main':
main.cpp:(.text+0xdd0): warning: the `gets' function is dangerous and should not be used.
/usr/local/lib/libmxio_x64.so: undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/johau/ros_ws/devel/lib/master/main] Error 1
make[2]: Leaving directory `/home/johau/ros_ws/build'
make[1]: *** [master/CMakeFiles/main.dir/all] Error 2
make[1]: Leaving directory `/home/johau/ros_ws/build'
make: *** [all] Error 2
Invoking "make" failed

[EDIT 3] Both of @fenix688 's suggestions are giving this output (with VERBOSE=1): [编辑 3] @fenix688 的两个建议都给出了这个输出(VERBOSE=1):

Base path: /home/johau/ros_ws
Source space: /home/johau/ros_ws/src
Build space: /home/johau/ros_ws/build
Devel space: /home/johau/ros_ws/devel
Install space: /home/johau/ros_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/johau/ros_ws/build"
####
#### Running command: "make VERBOSE=1 -j8 -l8" in "/home/johau/ros_ws/build"
####
/usr/bin/cmake -H/home/johau/ros_ws/src -B/home/johau/ros_ws/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/johau/ros_ws/build/CMakeFiles /home/johau/ros_ws/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/johau/ros_ws/build'
make -f master/CMakeFiles/main.dir/build.make master/CMakeFiles/main.dir/depend
make[2]: Entering directory `/home/johau/ros_ws/build'
cd /home/johau/ros_ws/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/johau/ros_ws/src /home/johau/ros_ws/src/master /home/johau/ros_ws/build /home/johau/ros_ws/build/master /home/johau/ros_ws/build/master/CMakeFiles/main.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/johau/ros_ws/build'
make -f master/CMakeFiles/main.dir/build.make master/CMakeFiles/main.dir/build
make[2]: Entering directory `/home/johau/ros_ws/build'
Linking CXX executable /home/johau/ros_ws/devel/lib/master/main
cd /home/johau/ros_ws/build/master && /usr/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/usr/bin/c++       CMakeFiles/main.dir/src/main.cpp.o  -o /home/johau/ros_ws/devel/lib/master/main  -L/usr/local/lib -rdynamic -lpthread -lboost_thread -lpthread -lmxio_x64 /opt/ros/indigo/lib/libroscpp.so -lboost_signals -lboost_filesystem /opt/ros/indigo/lib/librosconsole.so /opt/ros/indigo/lib/librosconsole_log4cxx.so /opt/ros/indigo/lib/librosconsole_backend_interface.so -llog4cxx -lboost_regex /opt/ros/indigo/lib/libxmlrpcpp.so /opt/ros/indigo/lib/libroscpp_serialization.so /opt/ros/indigo/lib/librostime.so -lboost_date_time /opt/ros/indigo/lib/libcpp_common.so -lboost_system -lboost_thread -lpthread -lconsole_bridge -lmxio_x64 /opt/ros/indigo/lib/libroscpp.so -lboost_signals -lboost_filesystem /opt/ros/indigo/lib/librosconsole.so /opt/ros/indigo/lib/librosconsole_log4cxx.so /opt/ros/indigo/lib/librosconsole_backend_interface.so -llog4cxx -lboost_regex /opt/ros/indigo/lib/libxmlrpcpp.so /opt/ros/indigo/lib/libroscpp_serialization.so /opt/ros/indigo/lib/librostime.so -lboost_date_time /opt/ros/indigo/lib/libcpp_common.so -lboost_system -lconsole_bridge -Wl,-rpath,/usr/local/lib:/opt/ros/indigo/lib 
CMakeFiles/main.dir/src/main.cpp.o: In function `main':
main.cpp:(.text+0xdd0): warning: the `gets' function is dangerous and should not be used.
/usr/local/lib/libmxio_x64.so: undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/johau/ros_ws/devel/lib/master/main] Error 1
make[2]: Leaving directory `/home/johau/ros_ws/build'
make[1]: *** [master/CMakeFiles/main.dir/all] Error 2
make[1]: Leaving directory `/home/johau/ros_ws/build'
make: *** [all] Error 2
Invoking "make" failed

While if I remove everything with pthread from the CMakeLists.txt do I get this VERBOSE=1 output, where -lpthread still is set.如果我从 CMakeLists.txt 中使用 pthread 删除所有内容,我会得到这个 VERBOSE=1 输出,其中 -lpthread 仍然设置。

Base path: /home/johau/ros_ws
Source space: /home/johau/ros_ws/src
Build space: /home/johau/ros_ws/build
Devel space: /home/johau/ros_ws/devel
Install space: /home/johau/ros_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/johau/ros_ws/build"
####
####
#### Running command: "make VERBOSE=1 -j8 -l8" in "/home/johau/ros_ws/build"
####
/usr/bin/cmake -H/home/johau/ros_ws/src -B/home/johau/ros_ws/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/johau/ros_ws/build/CMakeFiles /home/johau/ros_ws/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/johau/ros_ws/build'
make -f master/CMakeFiles/main.dir/build.make master/CMakeFiles/main.dir/depend
make[2]: Entering directory `/home/johau/ros_ws/build'
cd /home/johau/ros_ws/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/johau/ros_ws/src /home/johau/ros_ws/src/master /home/johau/ros_ws/build /home/johau/ros_ws/build/master /home/johau/ros_ws/build/master/CMakeFiles/main.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/johau/ros_ws/build'
make -f master/CMakeFiles/main.dir/build.make master/CMakeFiles/main.dir/build
make[2]: Entering directory `/home/johau/ros_ws/build'
Linking CXX executable /home/johau/ros_ws/devel/lib/master/main
cd /home/johau/ros_ws/build/master && /usr/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/usr/bin/c++       CMakeFiles/main.dir/src/main.cpp.o  -o /home/johau/ros_ws/devel/lib/master/main  -L/usr/local/lib -rdynamic -lmxio_x64 /opt/ros/indigo/lib/libroscpp.so -lboost_signals -lboost_filesystem /opt/ros/indigo/lib/librosconsole.so /opt/ros/indigo/lib/librosconsole_log4cxx.so /opt/ros/indigo/lib/librosconsole_backend_interface.so -llog4cxx -lboost_regex /opt/ros/indigo/lib/libxmlrpcpp.so /opt/ros/indigo/lib/libroscpp_serialization.so /opt/ros/indigo/lib/librostime.so -lboost_date_time /opt/ros/indigo/lib/libcpp_common.so -lboost_system -lboost_thread -lpthread -lconsole_bridge -Wl,-rpath,/usr/local/lib:/opt/ros/indigo/lib 
CMakeFiles/main.dir/src/main.cpp.o: In function `main':
main.cpp:(.text+0xdd0): warning: the `gets' function is dangerous and should not be used.
/usr/local/lib/libmxio_x64.so: undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/johau/ros_ws/devel/lib/master/main] Error 1
make[2]: Leaving directory `/home/johau/ros_ws/build'
make[1]: *** [master/CMakeFiles/main.dir/all] Error 2
make[1]: Leaving directory `/home/johau/ros_ws/build'
make: *** [all] Error 2
Invoking "make" failed

[EDIT 4] Tried with the CMakeLists.txt @fenix688 wrote and it gave the same error with this output: [编辑 4] 尝试使用 CMakeLists.txt @fenix688 写的,它给出了与此输出相同的错误:

Base path: /home/johau/ros_ws
Source space: /home/johau/ros_ws/src
Build space: /home/johau/ros_ws/build
Devel space: /home/johau/ros_ws/devel
Install space: /home/johau/ros_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/johau/ros_ws/build"
####
####
#### Running command: "make VERBOSE=1 -j8 -l8" in "/home/johau/ros_ws/build"
####
/usr/bin/cmake -H/home/johau/ros_ws/src -B/home/johau/ros_ws/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/johau/ros_ws/build/CMakeFiles /home/johau/ros_ws/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/johau/ros_ws/build'
make -f master/CMakeFiles/main.dir/build.make master/CMakeFiles/main.dir/depend
make[2]: Entering directory `/home/johau/ros_ws/build'
cd /home/johau/ros_ws/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/johau/ros_ws/src /home/johau/ros_ws/src/master /home/johau/ros_ws/build /home/johau/ros_ws/build/master /home/johau/ros_ws/build/master/CMakeFiles/main.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/johau/ros_ws/build'
make -f master/CMakeFiles/main.dir/build.make master/CMakeFiles/main.dir/build
make[2]: Entering directory `/home/johau/ros_ws/build'
Linking CXX executable /home/johau/ros_ws/devel/lib/master/main
cd /home/johau/ros_ws/build/master && /usr/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/usr/bin/c++       CMakeFiles/main.dir/src/main.cpp.o  -o /home/johau/ros_ws/devel/lib/master/main  -L/usr/local/lib -rdynamic -lpthread -lmxio_x64 /opt/ros/indigo/lib/libroscpp.so -lboost_signals -lboost_filesystem /opt/ros/indigo/lib/librosconsole.so /opt/ros/indigo/lib/librosconsole_log4cxx.so /opt/ros/indigo/lib/librosconsole_backend_interface.so -llog4cxx -lboost_regex /opt/ros/indigo/lib/libxmlrpcpp.so /opt/ros/indigo/lib/libroscpp_serialization.so /opt/ros/indigo/lib/librostime.so -lboost_date_time /opt/ros/indigo/lib/libcpp_common.so -lboost_system -lboost_thread -lpthread -lconsole_bridge -lboost_thread -lpthread -lconsole_bridge -Wl,-rpath,/usr/local/lib:/opt/ros/indigo/lib 
CMakeFiles/main.dir/src/main.cpp.o: In function `main':
main.cpp:(.text+0xdd0): warning: the `gets' function is dangerous and should not be used.
/usr/local/lib/libmxio_x64.so: undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/johau/ros_ws/devel/lib/master/main] Error 1
make[2]: Leaving directory `/home/johau/ros_ws/build'
make[1]: *** [master/CMakeFiles/main.dir/all] Error 2
make[1]: Leaving directory `/home/johau/ros_ws/build'
make: *** [all] Error 2
Invoking "make" failed

Well, we need to investigate on your issue.好吧,我们需要调查你的问题。 When you run make after cmake, could you run make VERBOSE=1 so that we can see the actual command it execute and whether the pthread flag is specified correctly.当你在cmake之后运行make时,你能不能运行make VERBOSE=1 ,这样我们就可以看到它执行的实际命令以及pthread标志是否指定正确。 you can also refer to this thread: Using CMake with GNU Make: How can I see the exact commands?你也可以参考这个帖子: Using CMake with GNU Make: How can I see the exact commands?

You could try this complete CMakeLists.txt code:你可以试试这个完整的 CMakeLists.txt代码:

cmake_minimum_required(VERSION 2.8.3)
project(master)

unset(MOXA_LIBRARY CACHE)

find_library(
   MOXA_LIBRARY
   NAMES mxio_x64
   PATHS /usr/local/lib
   PATH_SUFFIXES lib
   NO_DEFAULT_PATH
)

if(MOXA_LIBRARY STREQUAL "MOXA_LIBRARY-NOTFOUND")
    message(WARNING "Moxa Library not present !")
else()
    add_definitions(-DUSE_MOXA)
endif()

find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
)

## System dependencies are found with CMake's conventions
find_package(Boost COMPONENTS thread REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

###################################
## catkin specific configuration ##
###################################

catkin_package(
   CATKIN_DEPENDS roscpp std_msgs
)

include_directories(${catkin_INCLUDE_DIRS})

find_package(Threads REQUIRED)

## Declare a cpp executable
add_executable(main src/main.cpp)

## Specify libraries to link a library or executable target against
target_link_libraries (main    ${CMAKE_THREAD_LIBS_INIT}
                               ${MOXA_LIBRARY}
                               ${catkin_LIBRARIES}
                               ${Boost_LIBRARIES})

I hope it works!我希望它有效!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM