Qt QextSerialPort static lib

How to create static library QextSerialPort for Windows platform for use with Qt 4.8.5

I don't understand how to change the .pro or .pri files for this. (The .prf file keeps recovering).

So, I tried to modify the resulting .vcproj file to make a static build, and removed some of the definitions, but I still get warnings like:

qextserialport.lib (qextserialport.obj): warning LNK4006: "public: __thiscall QextSerialPort :: QextSerialPort (class QString const &, enum QextSerialPort :: QueryMode, class QObjectAB *)" (?? 0Qext@QAerialPort @String 0 @PAVQObject @@@ Z) is already defined in qextserialportd1.lib (qextserialportd1.dll); the second definition is ignored

and get "System error: the program cannot start because qextserailportd1.dll is missing from your computer". Which of course is true because I am trying to do a static build using .lib

So how do you do a static build correctly?

+3


source to share


2 answers


There is no need to create a static QextSerialPort library. You can just use the source code in your application. Just add the file .pri

to your file .pro

:

include(Path/To/qextserialport.pri)

      

Or copy the QextSerialPort source code from directory src

to application directory and add the following line to your project file:

include(qextserialport.pri)

      

Now you can include the header file:



#include "qextserialport.h"

      

And use the library:

QextSerialPort * port = new QextSerialPort("COM1");
connect(port, SIGNAL(readyRead()), this, SLOT(onDataAvailable()));
port->open();

      

No need to link a library or place a DLL for deployment.

+1


source


Thanks to Nejat for your answer. Very clear.

Also, for those following in my footsteps, this was a reading-guide case for me. Answer: https://code.google.com/p/qextserialport/wiki/QextSerialPort_1_2_RC



It just says to add CONFIG + = qesp_static

to the .pro file. This works too.

0


source







All Articles