reference - CMake: fail import external library -
I get this error when I try to compile:
linking CXX executable / home / atv / catkin_ws / devel / lib / atv acrowser / main ** CMakeFiles / main.dir / src / sendToCAN.cpp.o: `sendCAN () 'in the function: sendToCAN.cpp :( .text + 0x432): 'Undefined reference' for 'Send Message' (collection) * Collection 2: LD has created 1 exit status [2]: *** [Home / ATV / Katine_way / Develop / Lib / ATA Accoror / Main] make error 1 [1]: ** * [AtvAcrosser / CMakeFiles / Main.dir / all] Make error 2: *** Include [all] error 2 "create" failed main call thread sendCAN [inside sendToCAN.cpp ] that calls the sendCanMessage function to the external column libARV6005.a . This is CMakeList.txt : include_directory (include $ {catkin_INCLUDE_DIRS}) LINK_DIRECTORIES ($ {CMAKE_SOURCE_DIR} / ATAcron / Lib /) Add_executable (main src / main.cpp src / setupPacketProtocol.cpp src / sendToC AN.cpp) target_link_libraries (main $ {catkin_LIBRARIES} ARV 6005) This tree is:
src ???? Line a???? Atquecoser a ???? one one" ???? Line CMakeLists.txt is a "one" ???? Line Add a ???? One ???? One ???? One ???? Line ATVcronor A "A" A "A" ???? Line ARV 6005 Lib H. one one" ???? Line Line LocalPlannerCommunication.hA "A" A "A" ???? ReceiveFromCAN.h A "A" A "A" ???? SetupPacketProtocol.h a "One" ???? Line Lib รข ???? One ???? One ???? One ???? Line Libarv6005.a one ???? One ???? One ???? Line Package.xml one ???? One ???? Line Line Source a "one" a "a" ???? LocalPlannerCommunication.cpp A "A" A "A" ???? Main.cpp is an "a" a "a" ???? SendToCAN.cpp A "A" A "A" ???? SetupPacketProtocol.cpp sendToCAN.h
// Include dependency #include "ARV6005Lib.h" // ========== ====================== // function zero SendCAN (); sendToCAN.cpp
#include "../include/atvAcrosser/sendToCAN.h" ... zero sendCAN () {struct CanMsg msg; Struct CanMsg msg; Int i, results; MEMSet ((Zero *) and msg, 0, Message size); Msg.id = 0x33; Msg.id_type = STD_ID; Msg.length = 8; For (i = 0; i & lt; 8; i ++) {msg.data [i] = i; } Results = Transmissive (& amp; msg); } But with this Makefile works in a tutorial example all: main.c gcc -w -o testUtility -D_REENTRANT-I ../ library -Prath./main.c./libarv6005.a
- Check that
sendCanMessage (CanMsg *) has been declared in ARV6005Lib.h - Check that < code> libARV6005.a symbol
sendCanMessage - if the symbol
sendCanMessage is not in libARV6005.a , address Execute Yoga With Where It Is and Link It Others - Run
make VERBOSE = 1 , remove the link command and post it here - your
CMakeLists.txt you _REENTRANT and pthread are unavailable. Use it to add and target_link_libraries.
Comments
Post a Comment