Reputation: 563
I'm trying to get LibSerial to work but I am getting some linker errors when I try to compile my app using LibSerial. The errors are as follows:
/tmp/ccnVfHa2.o: In function `main':
index.cpp:(.text+0x26): undefined reference to `LibSerial::SerialStream::SerialStream()'
index.cpp:(.text+0x7c): undefined reference to `LibSerial::SerialStream::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::_Ios_Openmode)'
index.cpp:(.text+0xa9): undefined reference to `LibSerial::SerialStream::Close()'
index.cpp:(.text+0xb8): undefined reference to `LibSerial::SerialStream::~SerialStream()'
index.cpp:(.text+0x108): undefined reference to`LibSerial::SerialStream::~SerialStream()'
collect2: error: ld returned 1 exit status
My code for a small setup app is:
#include <iostream>
#include <SerialStream.h>
using namespace LibSerial;
int main() {
SerialStream sStream;
sStream.Open("/dev/ttyUSB0");
sStream.Close();
}
I am compiling with:
g++ -Wall -lserial index.cpp
But also tried:
g++ -l:libserial.so.0 index.cpp
And the response from dpkg -L libserial0
is:
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libserial0
/usr/share/doc/libserial0/copyright
/usr/share/doc/libserial0/changelog.Debian.gz
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libserial.so.0.0.0
/usr/lib/x86_64-linux-gnu/libserial.so.0
Thanks for taking a look!
Upvotes: 0
Views: 172