Hi
I'm trying to build the example on this wiki: http://qt-project.org/wiki/QtSerialPort
I'm using Qt5 and Debian Wheezy.
After building and installing the libraries (i think), when i try to build the application e get:
error: Unknown module(s) in QT: serialport
My .pro is like this.
#-------------------------------------------------
#
# Project created by QtCreator 2013-03-09T10:12:11
#
#-------------------------------------------------QT += serialport
QT += serialport
QT += core
QT -= gui
TARGET = serial01
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
#-------------------------------------------------
#
# Project created by QtCreator 2013-03-09T10:12:11
#
#-------------------------------------------------QT += serialport
QT += serialport
QT += core
QT -= gui
TARGET = serial01
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
main.cpp
#include <QCoreApplication>
#include <QDebug>
#include <QtSerialPort/qserialport.h>
#include <QtSerialPort/qserialportinfo.h>
QT_USE_NAMESPACE_SERIALPORT
int main(int argc, char *argv[])
{
// Example use SerialPortInfo
foreach (const SerialPortInfo &info, SerialPortInfo::availablePorts()) {
qDebug() << "Name : " << info.portName();
qDebug() << "Description : " << info.description();
qDebug() << "Manufacturer: " << info.manufacturer();
// Example use SerialPort
SerialPort serial;
serial.setPort(info);
serial.close();
}
return a.exec();
}
#include <QCoreApplication>
#include <QDebug>
#include <QtSerialPort/qserialport.h>
#include <QtSerialPort/qserialportinfo.h>
QT_USE_NAMESPACE_SERIALPORT
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
// Example use SerialPortInfo
foreach (const SerialPortInfo &info, SerialPortInfo::availablePorts()) {
qDebug() << "Name : " << info.portName();
qDebug() << "Description : " << info.description();
qDebug() << "Manufacturer: " << info.manufacturer();
// Example use SerialPort
SerialPort serial;
serial.setPort(info);
if (serial.open(QIODevice::ReadWrite))
serial.close();
}
return a.exec();
}
To copy to clipboard, switch view to plain text mode
There also seeams to be a problem with the QT_USE_NAMESPACE_SERIALPORT
What is missing here?
Bookmarks