Skip to content

Linker error on Linux64 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lnxdxC opened this issue Feb 2, 2023 · 1 comment
Open

Linker error on Linux64 #2

lnxdxC opened this issue Feb 2, 2023 · 1 comment

Comments

@lnxdxC
Copy link

lnxdxC commented Feb 2, 2023

Hi all,
thank you for providing the cpp-samples.

I am about to bring this onto an Linux64 architecture. Therefore, I cloned your repo and downloaded the linker files as mentioned in your readme.

I adapted the simpleApp.cpp to be used with bluetooth. Therefore, I changed in #16:
const std::string MAC_Addres = "BTH00:07:80:XX:XX:XX"; // the MAC were tested successfully with the python example

If I try to compile the file simpleApp.cpp by using the following setting:

g++ -o main simpleApp.cpp -L:Linux64 libplux.a -std=c++11

I receive the following error:

/usr/bin/ld: /tmp/ccl8F7kH.o: in function main':
simpleApp.cpp:(.text+0x140): undefined reference to SimpleDev::version[abi:cxx11]()' /usr/bin/ld: simpleApp.cpp:(.text+0x205): undefined reference to SimpleDev::start(float, std::vector<int, std::allocator > const&, int)'
/usr/bin/ld: simpleApp.cpp:(.text+0x29d): undefined reference to SimpleDev::read(std::vector<SimpleDev::Frame, std::allocator<SimpleDev::Frame> >&)' /usr/bin/ld: simpleApp.cpp:(.text+0x375): undefined reference to SimpleDev::stop()'
/usr/bin/ld: /tmp/ccl8F7kH.o: in function SimpleDev::SignalsDevX::SignalsDevX(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': simpleApp.cpp:(.text._ZN9SimpleDev11SignalsDevXC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN9SimpleDev11SignalsDevXC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2a): undefined reference to vtable for SimpleDev::SignalsDevX'
/usr/bin/ld: /tmp/ccl8F7kH.o: in function SimpleDev::SignalsDevX::~SignalsDevX()': simpleApp.cpp:(.text._ZN9SimpleDev11SignalsDevXD2Ev[_ZN9SimpleDev11SignalsDevXD5Ev]+0x13): undefined reference to vtable for SimpleDev::SignalsDevX'
/usr/bin/ld: libplux.a(bth_linux.o): in function BTH::BTH(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': bth_linux.cpp:(.text+0x5c9): undefined reference to str2ba'
/usr/bin/ld: libplux.a(bth_linux.o): in function BTH::findDevices()': bth_linux.cpp:(.text+0x897): undefined reference to hci_get_route'
/usr/bin/ld: bth_linux.cpp:(.text+0x8a8): undefined reference to hci_open_dev' /usr/bin/ld: bth_linux.cpp:(.text+0x8e4): undefined reference to hci_inquiry'
/usr/bin/ld: bth_linux.cpp:(.text+0xa6d): undefined reference to ba2str' /usr/bin/ld: bth_linux.cpp:(.text+0xa84): undefined reference to hci_read_remote_name'`

Additionally, I had to include the following lib in simpleDev.h to use sprintf in #37 in simpleDev.cpp in Linux:

  • #include <stdio.h>

Do you provide a more open lib to debug the issue as well?

Best
Daniel

@lnxdxC lnxdxC changed the title Compilation error on Linux64 Compiler error on Linux64 Feb 2, 2023
@lnxdxC
Copy link
Author

lnxdxC commented Feb 2, 2023

I have isolated the issue a bit further. I`ve reinstalled libbluetooth-dev and parsed the lib to the linker.

Building the object with:
g++ -o main simpleApp.cpp -L:Linux64 libplux.a -lbluetooth -std=c++11 yield:

/tmp/cccZuDST.o: in function SimpleDev::SignalsDevX::SignalsDevX(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': simpleApp.cpp:(.text._ZN9SimpleDev11SignalsDevXC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN9SimpleDev11SignalsDevXC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2a): undefined reference to vtable for SimpleDev::SignalsDevX'
/usr/bin/ld: /tmp/cccZuDST.o: in function SimpleDev::SignalsDevX::~SignalsDevX()': simpleApp.cpp:(.text._ZN9SimpleDev11SignalsDevXD2Ev[_ZN9SimpleDev11SignalsDevXD5Ev]+0x13): undefined reference to vtable for SimpleDev::SignalsDevX'

Which is coursed by the line "SimpleDev dev(MAC_Addres);" in the simpleApp.cpp

@lnxdxC lnxdxC changed the title Compiler error on Linux64 Linker error on Linux64 Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant