質問

I am using Qt 4.7.4 and Qt Creator 2.4.1. I am trying to build blockingmaster code for serial communication, example given on Qt site.

But after required modification for my environment and path destination, when I tried to build the project. It gives me:

QtSerialPort/QSerialPortInfo: No such file or directory

After following this link (with no success);

My .pro file looks like:

CONFIG += serialport
QT += widgets

TARGET = blockingmaster
TEMPLATE = app

HEADERS += \
    dialog.h \
    masterthread.h

SOURCES += \
    main.cpp \
    dialog.cpp \
    masterthread.cpp

But the error remains the same. I have tried the things upsite down.

Serial communication via QT is a new task for me, so I was trying with example given on Qt website. Can anyone provide me more information to get rid of this error?

役に立ちましたか?

解決

Thanks to all for their valuable suggestions.

QtSerialPort library is an added feature for Qt5 .It is always advisable to use inbuilt library created by qt.

Since QtSerialPort library is not supported by Qt 4.7 or lower version.

I was able to design an Application using Qt 4.7 itself. It needs to include library for serial communication as Qt 4.7 has no in-build library for serial port. I did it using following link :

For Windows add the "qextserialport-1.2rc" (download using following link)

Qextserialport Example - Hyperterminal Windows

For Linux add library "myser1.zip" (download using following link)

Qextserialport Example - Hyperterminal Linux

Above links also includes the application for Serial Communication for respective OS. Adding the libraries from the above application helped me designing an Application for my task.

The above answer will help the developers who are not permissible to upgrade Qt-tool due to company policy etc.

Hope this will help others to solve the similar problems.

他のヒント

Could you please try 4.8?

It should work with that, but try first without Qt Creator, and then if it works, with the IDE.

We have not tested 4.7 lately, hence there might be issues. 4.8 should work. If something does not, we need to find the root cause, file a bugreport, and we will fix it.

Here you can find more information about this module that I wrote up when it was becoming an official Qt add-on.

The example you're looking at is for Qt 5 (probably even 5.1), it won't work with Qt 4. Try the latest 5.1 release candidate.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top