hlm
Posts: 1
Joined: Wed Dec 30, 2015 2:13 pm

Getting Qt5 with Serialport on Raspberry Pi 2

Wed Dec 30, 2015 2:29 pm

Hi everybody,

i am really new to raspberry pi (and also to linux), but i have trouble to get my Qt-Application (which i wrote on a Windows Computer) running on my raspberry pi 2.

I installed QT on Raspberry with:
  • sudo apt-get update
    sudo apt-get dist-upgrade
    sudo apt-get install qt5-default qtcreator
Everything seems to run fine but when i try to compile my Application, it says "unknown module(s) in QT: serialport".

I have tried to install Qt like this way (viewtopic.php?f=63&t=96761) but it says thats everything is already installed and up to date.

I have also read a lot about building Qt nativly on the Raspberry Pi 2, but I would like to avoid this if possible.

I am really sorry for that probably stupid Question, but I have searched a lot until now and i dont find a proper solution.

Thanks in advance for any help,

Hannes

pholy
Posts: 46
Joined: Sun Jun 24, 2012 11:29 pm

Re: Getting Qt5 with Serialport on Raspberry Pi 2

Sun Jan 17, 2016 11:52 pm

A late reply, for anybody searching for the qt5 serialport:

The serialport module has its own package:

apt-get install libqt5serialport5

sunny127
Posts: 1
Joined: Thu Nov 10, 2016 1:19 pm

Re: Getting Qt5 with Serialport on Raspberry Pi 2

Thu Nov 10, 2016 1:24 pm

Tested on Raspberry Pi 3 Jessie, Qt 5.3.2

You have to install:

1)
sudo apt-get install libqt5serialport5
sudo apt-get install libqt5serialport5-dev

2) add in the .pro file
QT += serialport

3) int the .h file add:
#include <QtSerialPort/QSerialPort>

Jerwinprabu
Posts: 11
Joined: Mon Aug 01, 2016 1:04 pm

Re: Getting Qt5 with Serialport on Raspberry Pi 2

Wed Apr 19, 2017 8:18 am

Waw Great. Very useful @sunny. For Getting Qt5 with Serialport on Raspberry Pi 3, I have tried. Now is it possible to interact with Arduino and Raspberry(QT creator with Arduino IDE).

mikeh32217
Posts: 3
Joined: Fri Oct 09, 2015 4:36 pm

Re: Getting Qt5 with Serialport on Raspberry Pi 2

Fri Feb 23, 2018 7:30 pm

Thanks been searching for about an hour to try to get serialport to be recognized on Pi. Had about thought ole Mr. Google didn't have the answer!

jachaney
Posts: 13
Joined: Wed Jun 20, 2018 10:00 pm

Re: Getting Qt5 with Serialport on Raspberry Pi 2

Mon Aug 06, 2018 3:06 pm

Going to give this a try as soon as I get back home. I have been looking for this solution for about three days. Seems, the Raspberry (Raspbian) installation should include this automatically, since it is designed for simple interface projects that would need it.

Vladislav
Posts: 2
Joined: Thu Aug 22, 2019 8:33 am

Getting Qt5 with Serialport on Raspberry Pi 2

Thu Aug 22, 2019 9:58 am

I have no serialport libraries defined:

Code: Select all

#include <QtSerialPort/QSerialPort>

pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
QT += serialport

SOURCES += \
        main.c

LIBS += -L/usr/local/lib -lwiringPi
LIBS += -L/usr/local/lib -lwiringPiDev
INCLUDEPATH += /usr/local/include

error:
/home/pi/qt/qprj/main.c:6: error: 'QtSerialPort/QSerialPort' file not found
/home/pi/qt/qprj/main.c:6: error: QtSerialPort/QSerialPort: No such file or directory
 #include <QtSerialPort/QSerialPort>
          ^~~~~~~~~~~~~~~~~~~~~~~~~
I have raspbian and serial port lib instaled.

jdonald
Posts: 413
Joined: Fri Nov 03, 2017 4:36 pm

Re: Getting Qt5 with Serialport on Raspberry Pi 2

Thu Aug 22, 2019 7:09 pm

Well the header is in there on Buster. Double-check that you installed the headers (not just the library) with:

Code: Select all

sudo apt-get install libqt5serialport5-dev
and if that's covered you could then try explicitly adding /usr/include/arm-linux-gnueabihf/qt5 to your INCLUDEPATH.

Return to “General discussion”