PDA

View Full Version : error: Unknown module(s) in QT: serialport



aguleo
9th March 2013, 15:17
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


main.cpp


#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();
}


There also seeams to be a problem with the QT_USE_NAMESPACE_SERIALPORT

What is missing here?

wysota
9th March 2013, 16:26
How did you install the library?

aguleo
9th March 2013, 16:47
#1 - downloaded the code from http://qt.gitorious.org/qt/qtserialport/archive-tarball/master

#2 - uncompressed it to ~/Downloads/qt-qtserialport

#3 - created a buil location ~/Downloads/qt-qtserialportbuild$

#4 - In #3 folder executed
qmake ../qt-qtserialport/qtserialport.pro
make
su -c "make install"

Looking better ...there seems to be no .so library! Where showld it be?

Added after 7 minutes:

And i have:

$ ls -l /usr/include/Q*
total 28
-rw-r--r-- 1 root root 25 Mar 9 10:09 QSerialPort
-rw-r--r-- 1 root root 2392 Mar 2 17:47 qserialportglobal.h
-rw-r--r-- 1 root root 8438 Mar 2 17:47 qserialport.h
-rw-r--r-- 1 root root 29 Mar 9 10:09 QSerialPortInfo
-rw-r--r-- 1 root root 3266 Mar 2 17:47 qserialportinfo.h

wysota
9th March 2013, 17:42
From what I see it should be in the same directory as your Qt libraries.

aguleo
11th March 2013, 21:54
The examples in the "example" folder build correctly, and i was able to do basic serial communication.
The errors i mentioned above must be related to Qt version!