Closed Aneoshun closed 5 years ago
Searching through the code, I could not find any double definition of this function. Do you have more context to this error ? Could it be related to the namespace and a redefinition in your code ?
The function is not defined multiple times in the code, but it becomes defined multiple time when you have several transaltion units, e.g., when you compile a static lib and then link against it.
Here is a minimal example (you might have to change the hard-coded path to find libdynamixel in the ./src/wscript). mini_example.zip
Here is the compilation result:
$ ./waf
Waf: Entering directory `/home_nfs/antoine/git/mini_example/build'
[1/4] Compiling src/hexapod.cpp
[2/4] Compiling src/main.cpp
[3/4] Linking build/src/libhexapod.a
[4/4] Linking build/src/example
src/libhexapod.a(hexapod.cpp.1.o): In function `dynamixel::write_error_string[abi:cxx11](int)':
hexapod.cpp:(.text+0x0): multiple definition of `dynamixel::write_error_string[abi:cxx11](int)'
src/main.cpp.2.o:main.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
Hello @Aneoshun,
I have done the modification in branch dev. I let the issue open until we merge it in master. Let me know if it works on your side. Thanks
Dear all,
usb2dynamixel.hpp
declares and defines the following function, which seems to cause the following errormultiple definition of `dynamixel::write_error_string[abi:cxx11](int)'
when I try to use a usb2dynamixel controller inside a static library.https://github.com/resibots/libdynamixel/blob/1574c43867569082253c3f3b3b14443e9d349ce9/src/dynamixel/controllers/usb2dynamixel.hpp#L27
Would it be possible to put this function inline? like this:
inline std::string write_error_string(int error_number)
Thanks