Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt QextSerialPort static lib

How do I make a static library of QextSerialPort for windows platform for use with Qt 4.8.5

I do not understand how to modify the .pro or .pri files to do this. (The .prf file keeps regenerating).

So I tried modifying the resultant .vcproj file to make a static build, and removed some of the defines, but I still get warnings like:

qextserialport.lib(qextserialport.obj) : warning LNK4006: "public: __thiscall QextSerialPort::QextSerialPort(class QString const &,enum QextSerialPort::QueryMode,class QObject *)" (??0QextSerialPort@@QAE@ABVQString@@W4QueryMode@0@PAVQObject@@@Z) already defined in qextserialportd1.lib(qextserialportd1.dll); second definition ignored

and at run time get "System Error: The program can't start because qextserailportd1.dll is missing from your computer". Which of course is true because I am trying to make a static build using a .lib

So how do I correctly do a static build?

like image 965
David Casper Avatar asked Aug 11 '26 21:08

David Casper


1 Answers

There is no need to build a static library of QextSerialPort. You can simply use the source code in your application. Just include it's .pri file in your .pro file :

include(Path/To/qextserialport.pri)

Or copy QextSerialPort source code from src directory to your 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();

Without any need to linking the library or putting the dll for deployment.

like image 139
Nejat Avatar answered Aug 13 '26 11:08

Nejat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!