PDA

View Full Version : qt serial port



saman_artorious
23rd April 2013, 13:30
I am using Qt 5. I need the serial class, I tried adding += serialport, but it fails. anyone knows which serial class is most suitable for serial communications (better be an interface class) as well as instructions to set it up in
Linux ?

Santosh Reddy
23rd April 2013, 13:45
I am using Qt 5. I need the serial class, I tried adding += serialport, but it fails.
What happens?

kuzulis
23rd April 2013, 15:12
Give more info.

[telepathist mode]
If you use QtSerialPort, then after building need to install library (maybe required superuser privileges for installation). See more info on WIKI (http://qt-project.org/wiki/QtSerialPort)!
[/telepathist mode]

saman_artorious
24th April 2013, 10:19
What happens?

it gives the following error:

:-1: error: [Makefile] Error 3 File no found

kuzulis
24th April 2013, 11:44
And what? You really scoff at us?

At such approach you won't receive any answers from us (from me).

saman_artorious
24th April 2013, 12:17
And what? You really scoff at us?

At such approach you won't receive any answers from us (from me).

I replied to Santosh question, as I was not sure if this module already exists in qt5 or shall installed as a seperate library. And... next time please make sure you are implying to the correct matter when you accuse members.

anyway,

My problem is with /usr/bin/moc-qt4, I already added /usr/bin/qt4 to the environment variable. but I cannot find anything called moc-qt4 in the system. I have qt 5 installed, but at we need qt4-qmake for libqtserial, I downloaded the package.



# make
cd src/ && make -f Makefile
make[1]: Entering directory `/home/saman/5.0.1/serialPort src/qtserialport/src'
cd serialport/ && make -f Makefile
make[2]: Entering directory `/home/saman/5.0.1/serialPort src/qtserialport/src/serialport'
/usr/bin/moc-qt4 -DQT_BUILD_SERIALPORT_LIB -DQT_NO_DEBUG -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I/include -I/include/QtSerialPort -I. qserialport.h -o moc_qserialport.cpp
make[2]: /usr/bin/moc-qt4: Command not found
make[2]: *** [moc_qserialport.cpp] Error 127
make[2]: Leaving directory `/home/saman/5.0.1/serialPort src/qtserialport/src/serialport'
make[1]: *** [sub-serialport-make_default] Error 2
make[1]: Leaving directory `/home/saman/5.0.1/serialPort src/qtserialport/src'
make: *** [sub-src-make_default-ordered] Error 2

saman_artorious
24th April 2013, 14:18
lib-qt4-dev was missed!
I cannot make, it cannot identify qtSerialPortInfo library.



main.cpp:(.text.startup+0x5e): undefined reference to `QSerialPortInfo::availablePorts()'
main.cpp:(.text.startup+0x10f): undefined reference to `QSerialPortInfo::isBusy() const'
main.cpp:(.text.startup+0x16b): undefined reference to `QSerialPortInfo::hasProductIdentifier() const'
main.cpp:(.text.startup+0x1bb): undefined reference to `QSerialPortInfo::hasVendorIdentifier() const'
main.cpp:(.text.startup+0x212): undefined reference to `QSerialPortInfo::manufacturer() const'
main.cpp:(.text.startup+0x24a): undefined reference to `QSerialPortInfo::description() const'
main.cpp:(.text.startup+0x282): undefined reference to `QSerialPortInfo::systemLocation() const'
main.cpp:(.text.startup+0x2ba): undefined reference to `QSerialPortInfo::portName() const'
main.cpp:(.text.startup+0x644): undefined reference to `QSerialPortInfo::productIdentifier() const'
main.cpp:(.text.startup+0x674): undefined reference to `QSerialPortInfo::vendorIdentifier() const'


why this happens? the QserialPortInfo.so file is already inside the src directory. I can also include it in qt application. but make fails!

kuzulis
24th April 2013, 14:55
See my post #3 above.

saman_artorious
24th April 2013, 15:30
See my post #3 above.

that is not relevant to the question I asked anymore.

to run the program, I forgot about the make error. I added the qserialport and qserialportinfo .so libraries to my current project. This way I also would not receive the Makefile error when I add serialport to config+=.

is that a good idea?
And I am not familiar with Qextserial class. I know that qserialport is created by developers and does not have much support. But, in my case if it supports threads (that it does) might suffice. what do you say?

kuzulis
24th April 2013, 16:19
that is not relevant to the question I asked anymore.

You wrong, it is important!



I added the qserialport and qserialportinfo .so libraries to my current project. This way I also would not receive the Makefile error when I add serialport to config+=.

is that a good idea?


You do everything wrong. Re-read again and again attentively Wiki.


And I am not familiar with Qextserial class.

I'm too.


I know that qserialport is created by developers and does not have much support.

I didn't understand you, about what qserialport there is a speech?


But, in my case if it supports threads (that it does) might suffice. what do you say?
I don't understand you.


PS:
You jump from one subject on other subject of your topic. First you write that you compile for Qt5,
next you write about problems with MOC from Qt4 and etc. It is difficult to me to watch a course of your
thoughts. You mixed everything in a heap.

Unclear that you want to make, etc.


UPD: If you use QtSerialPort - that all exhaustive information on compilation, installation and use of library read in WIKI.
I don't understand that isn't clear for you...