0

I'm trying to make use of libserial for my project in qt. I've installed the library and added it to my .pro file using LIBS += -L/usr/local/lib/ -lserial

I have a class

class SerialComm
{
    public:
        SerialStream node;

        SerialComm()
        {
            node.SetBaudRate(SerialStreamBuf::BAUD_9600);
            node.SetCharSize(SerialStreamBuf::CHAR_SIZE_8);
            node.Open("/dev/ttyACM0");
        }

};

However when I build it, I get the following error: undefined reference to `LibSerial::SerialStream::Open(std::__cxx11::basic_string, std::allocator >, std::_Ios_Openmode)'

At first I thought it was something to do with libserial but the error doesn't come up for

        node.SetBaudRate(SerialStreamBuf::BAUD_9600);
        node.SetCharSize(SerialStreamBuf::CHAR_SIZE_8);

Any ideas why this is happening?

  • I think it because libserial compiled with different compiler flags. Try turn off c++11 features in your program. – gomons Mar 11 '16 at 15:09
  • I suggest you compile libserial by yourself as part of your project (one of libraries of your project), using the same compiler options. – gomons Mar 11 '16 at 15:11

0 Answers0