报错usr/bin/ld: CMakeFiles/teleoperation.dir/src/teleoperation.cpp.o: in function `tele_callback(geometry_msgs::Twist_<std::allocator<void> > const&)': teleoperation.cpp:(.text+0xa61): undefined reference to `kinematics_ur::inverse_kinematics(double&, double&, double&, double&, double&, double&, double, double, double, double, double, double)' /usr/bin/ld: CMakeFiles/teleoperation.dir/src/teleoperation.cpp.o: in function `__static_initialization_and_destruction_0(int, int)': teleoperation.cpp:(.text+0x1ac7): undefined reference to `kinematics_ur::kinematics_ur()' collect2: error: ld returned 1 exit status make[2]: *** [Geomagic_Touch_ROS_Drivers/omni_common/CMakeFiles/teleoperation.dir/build.make:106: /home/yibeim/devel/Touch_ROS_Driver-master/catin_ws/devel/lib/omni_common/teleoperation] Error 1 make[1]: *** [CMakeFiles/Makefile2:2079: Geomagic_Touch_ROS_Drivers/omni_common/CMakeFiles/teleoperation.dir/all] Error 2 make: *** [Makefile:141: all] Error 2 Invoking "make -j4 -l4" failed
时间: 2023-03-12 16:56:59 浏览: 227
我不太明白您的问题,但是我可以尝试回答:我不了解您提到的usr/bin/ld、CMakeFiles/teleoperation.dir/src/teleoperation.cpp.o和tele_callback()函数,但我猜你可能在尝试调用某种函数来实现某项任务,而该函数可能与geometry_msgs::Twist_<std::allocator<void> >有关。
相关问题
usr/bin/ld: CMakeFiles/AVM_HIKVISION.dir/src/captures.cpp.o:(.bss+0x0): multiple definition of `last'; CMakeFiles/AVM_HIKVISION.dir/src/main.cpp.o:(.bss+0x0): first defined here /usr/bin/ld: CMakeFiles/AVM_HIKVISION.dir/include/AVM/birdview.cpp.o:(.bss+0x0): multiple definition of `last'; CMakeFiles/AVM_HIKVISION.dir/src/main.cpp.o:(.bss+0x0): first defined here /usr/bin/ld: CMakeFiles/AVM_HIKVISION.dir/src/mediawall.cpp.o:(.bss+0x0): multiple definition of `last'; CMakeFiles/AVM_HIKVISION.dir/src/main.cpp.o:(.bss+0x0): first defined here /usr/bin/ld: CMakeFiles/AVM_HIKVISION.dir/src/mediawall.cpp.o: in function `main': mediawall.cpp:(.text+0x137f): multiple definition of `main'; CMakeFiles/AVM_HIKVISION.dir/src/main.cpp.o:main.cpp:(.text+0x0): first defined here /usr/bin/ld: /home/wsh/software/media-server-avm1d/avm1d/lib/HCNet/libSophus.so: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status 这个是什么错误
这个错误是链接器(ld)报告的错误。它指出在多个目标文件中存在相同的符号定义,导致重复定义。具体来说,`last`和`main`这两个符号在不同的目标文件中被定义了多次。
可能的原因是在编译过程中,多个源文件包含了同名的全局变量或函数,导致冲突。
解决这个问题的方法是确保每个符号只有一个定义。你可以检查你的代码,看看是否有重复定义的全局变量或函数。如果是意外的重复定义,你可以删除其中一个定义。如果是有意为之的重复定义,你可以将它们重命名以避免冲突。
另外,错误信息中还提到了一个文件格式错误(`file in wrong format`),可能是由于使用了不兼容的库文件导致的。你可以检查使用的库文件是否与你的项目兼容,并尝试使用正确的版本。
希望能帮到你!如果有任何更多的问题,请随时提问。
FAILED: MyTestHttp : && /usr/bin/c++ -g CMakeFiles/MyTestHttp.dir/main.cpp.o -o MyTestHttp && : /usr/bin/ld: CMakeFiles/MyTestHttp.dir/main.cpp.o: in function `Http::Http()': /home/hy-20/project/MyTestHttp/main.cpp:20: undefined reference to `curl_global_init' /usr/bin/ld: /home/hy-20/project/MyTestHttp/main.cpp:21: undefined reference to `curl_easy_init' /usr/bin/ld: CMakeFiles/MyTestHttp.dir/main.cpp.o: in function `Http::~Http()': /home/hy-20/project/MyTestHttp/main.cpp:25: undefined reference to `curl_easy_cleanup' /usr/bin/ld: /home/hy-20/project/MyTestHttp/main.cpp:26: undefined reference to `curl_global_cleanup' /usr/bin/ld: CMakeFiles/MyTestHttp.dir/main.cpp.o: in function `Http::setUrl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/hy-20/project/MyTestHttp/main.cpp:29: undefined reference to `curl_easy_setopt' /usr/bin/ld: CMakeFiles/MyTestHttp.dir/main.cpp.o: in function `Http::setPostFields(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/hy-20/project/MyTestHttp/main.cpp:31: undefined reference to `curl_easy_setopt' /usr/bin/ld: CMakeFiles/MyTestHttp.dir/main.cpp.o: in function `Http::setMethod(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/hy-20/project/MyTestHttp/main.cpp:35: undefined reference to `curl_easy_setopt' /usr/bin/ld: /home/hy-20/project/MyTestHttp/main.cpp:36: undefined reference to `curl_easy_setopt' /usr/bin/ld: CMakeFiles/MyTestHttp.dir/main.cpp.o: in function `Http::setHeaders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/hy-20/project/MyTestHttp/main.cpp:41: undefined reference to `curl_slist_append' /usr/bin/ld: /home/hy-20/project/MyTestHttp/main.cpp:42: undefined reference to `curl_easy_setopt' /usr/bin/ld: CMakeFiles/MyTestHttp.dir/main.cpp.o: in function `Http::setWriteFunction(std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> const&)': /home/hy-20/project/MyTestHttp/main.cpp:46: undefined reference to `curl_easy_setopt' /usr/bin/ld: /home/hy-20/project/MyTestHttp/main.cpp:47: undefined reference to `curl_easy_setopt' /usr/bin/ld: CMakeFiles/MyTestHttp.dir/main.cpp.o: in function `Http::perform()': /home/hy-20/project/MyTestHttp/main.cpp:50: undefined reference to `curl_easy_perform' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
这是一个链接错误,编译器找不到 curl 库的函数。你需要在链接时加上 curl 库。如果你使用的是 CMake,可以在 CMakeLists.txt 中添加以下代码:
```
find_package(CURL REQUIRED)
target_link_libraries(YourProjectName ${CURL_LIBRARIES})
```
其中,YourProjectName 是你的项目名称。
阅读全文