Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 43

cannot specify link libraries for target

$
0
0
Hello everyone. I dont normally run to the forums for healp, but I have been dealing with an issue for two days and I am getting really frustrated. I am trying to interface with a LabJack from within a ROS node. The developers have published a .c file full of functions for native TCP operation. I have compiled it into a shared object library but I am unable to link to it (Upon linking, I get undefined reference errors on the lines where I call functions from the library). I found a post on this site that says after adding the /lib directory (where my shared object library lives) to the link directories in CMakeLists, given my lib as libfoo, I add to the CMakeLists file "target_link_libraries(myNode,foo)" When I do this, I get the following error CMake Error at CMakeLists.txt:36 (target_link_libraries): Cannot specify link libraries for target "myNode" which is not built by this project. I am completely stumped. I am pasting my CMakeLists.txt. file just incase it helps. My node is for a diesel generator, called 'dieselGenerator' and my library (for the LabJack) is called libue9.so. It looks like comments get put in bold here, I dont mean to yell. I really appreciate your help. Cheers
cmake_minimum_required (VERSION 2.4.6)
include ($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set (ROS_BUILD_TYPE RelWithDebInfo)

# Initialize the ROS build system.
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)


# Set the name to use for the executable.
set (BINNAME dieselGenerator)

# Set the source files to use with the executable.
#set (SRCS ${SRCS} src/ue9.c)
set (SRCS ${SRCS} src/dieselGenerator.cpp)

# Have ROS autogenerate code used in messages.
rosbuild_genmsg ()

# Set the directories where include files can be found.
include_directories (${PROJECT_SOURCE_DIR}/include)
# Make sure the compiler can find the libraries.
link_directories (${PROJECT_SOURCE_DIR}/lib)
target_link_libraries (dieselGenerator ue9)

# Build the executable that will be used to run this node.
rosbuild_add_executable (${BINNAME} ${SRCS})

# List the libraries here.
set (LIBS ${LIBS} ue9)


Viewing all articles
Browse latest Browse all 43

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>