[Interest] How do I use qextserialport as a library?

Robert Wood robert.wood at apostrophe.co.uk
Mon Mar 19 11:24:52 CET 2012


Hi Debao,

Many thanks, that's very good of you.

I am obviously missing something fundamental here as having knocked up a 
very simple test program and modding my .pro as follows:

QEXTSERIALPORT_LIBDIR = /usr/lib/
QEXTSERIALPORT_INCDIR =/usr/include/


QT       += core gui

TARGET = SharedSerial
TEMPLATE = app


SOURCES += main.cpp\
         mainwindow.cpp \
     uart.cpp

HEADERS  += mainwindow.h \
     uart.h \
     defines.h

FORMS    += mainwindow.ui

QEXTSERIALPORT_LIBNAME = $$qtLibraryTarget(qextserialport-1.2)

INCLUDEPATH += QEXTSERIALPORT_INCDIR
LIBS += -L$$QEXTSERIALPORT_LIBDIR -l$$QEXTSERIALPORT_LIBNAME
DEFINES += QEXTSERIALPORT_USING_SHARED


I get the error:

:-1: error: cannot find -lqextserialport-1.2

I am guessing that these double dollar signs have to be changed. My 
/usr/lib directory has:

/usr/lib/libqextserialport.so
/usr/lib/libqextserialport.so.1
/usr/lib/libqextserialport.so.1.2
/usr/lib/libqextserialport.so.1.2.0

If that's of any help.

I'm guessing I'm doing something very naive or stupid! I'm an embedded 
hardware and software engineer dealing in bits and bytes most of the 
time and really struggle with this stuff!

Thanks again.



On 18/03/12 23:17, 1+1=2 wrote:
> Hi Robert,
>
> I have updated the wiki page:
> http://code.google.com/p/qextserialport/wiki/QextSerialPort_1_2_Beta1
>
> "How to use (3)" discusses how to use QextSerialPort as shared library
> without adding "include(*****/qextserialport.pri)" to .pro file.
> And of course, in a cross platform way.
>
> Hope this can help you.
>
> If this is still refuse to work,feel free to report bugs.
>
> Regards,
>
> Debao
>
> On Sun, Mar 18, 2012 at 9:52 AM, Robert Wood
> <robert.wood at apostrophe.co.uk>  wrote:
>> \Folks,
>>
>> I've used qextserialport many times, but always included the source code
>> in the my project. However, the it says it's better to use it as a
>> library and it would be nice not to include all those source files each
>> time.
>>
>> However, I can't work out how to do this.
>>
>> I've downloaded the source, gone into the buildlib directory, done qmake
>> and make (as root) after uncommenting QEXTSERIALPORT_LIBRARY = yes.
>>
>> I get thie following in /usr/lib
>>
>> -rwxr-xr-x 1 root root 456104 Oct  9 21:19 libqextserialport.so*
>> -rwxr-xr-x 1 root root 456104 Oct  9 21:19 libqextserialport.so.1*
>> -rwxr-xr-x 1 root root 456104 Oct  9 21:19 libqextserialport.so.1.2*
>> -rwxr-xr-x 1 root root 456104 Oct  9 21:19 libqextserialport.so.1.2.0*
>>
>> I've put this in the .pro file:
>>
>> LIBS  += /usr/lib/libqextserialport.so
>>
>> Tried all sorts with #include and to be on the safe side:
>>
>> #include "/home/robertw/Software/qextserialport/src/qextserialport.h"
>> where the include file definitely is.
>>
>>
>> When I try to compile I get:
>>
>> /home/robertw/Software/Qt4/ltc1760-build-desktop/../ltc1760/ltc1760.cpp:66:
>> error: undefined reference to `QextSerialPort::QextSerialPort(QString
>> const&, QextSerialPort::QueryMode, QObject*)'
>>
>>
>> For this line:
>>
>>          vcp = new QextSerialPort(s);
>>
>> This is exactly how I open a port when I include the source, so this
>> line is not wrong (s is a string of its name).
>>
>> Would someone be able to advise what I'm doing wrong please?
>>
>> Thanks! :~)
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list