2 HSPalm
3. I then press the "build" button (hammer?), and get 336 warnings saying the same thing:
c:\Qt\serialport-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug\.qmake.cache:1: warning: Unmatched quotes are deprecated.
This is normal, just ignore these warnings.
but I have no such folder. I have also searched my computer for occurrences of these files, with no luck hehe. Where do I go from here?
In theory, after building the library, you must install it by typing:
$make install (if you use MinGW compiler)
or
$nmake install (if yuo use VS compiler)
But in reality it until does not work (incomplete), so to install the library, do the following:
!!!ONLY FOR Qt4.x!!!
1. Build library any way (or through QtCreator, or from the console) using serialport.pro as release and debug.
2. Copy folder /QtAddOnSerialPort (with all content) from library build directory to the Qt4 installation headers folder /include.
3. Copy file "serialport.prf" from source library folder /src/qt4support/ to the Qt4 installation folder /mkspecs/features/
4. Copy all builded libraries (as release ans as debug) SerialPort1.dll, SerialPortd1.dll, SerialPort1.lib (or *.a), SerialPortd1.lib (or *.a)
to the Qt4 installation library folder /lib
Now you can create a custom project that link library as follows:
Your *.pro file:
...
CONFIG += serialport
...
Your *.cpp file, for example:
#include <QCoreApplication>
#include <QtAddOnSerialPort/serialportinfo.h>
// and/or
#include <QtAddOnSerialPort/serialport.h>
#include <QDebug>
QT_USE_NAMESPACE_SERIALPORT
int main(int argc, char *argv[])
{
QList<SerialPortInfo> list = SerialPortInfo::availablePorts();
foreach (const SerialPortInfo &info, list) {
qDebug() << s;
}
return a.exec();
}
#include <QCoreApplication>
#include <QtAddOnSerialPort/serialportinfo.h>
// and/or
#include <QtAddOnSerialPort/serialport.h>
#include <QDebug>
QT_USE_NAMESPACE_SERIALPORT
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QList<SerialPortInfo> list = SerialPortInfo::availablePorts();
foreach (const SerialPortInfo &info, list) {
QString s = info.portName();
qDebug() << s;
}
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Enjoy....
Bookmarks