September 22, 2011

dvez43 dvez43
Ant Farmer
291 posts

Serial Ports in Qt 4.7

 

In the newest version of Qt, is there support for serial ports? (cross platform)

I am developing in Linux but would like a cross platform way to create a serial port connection between windows and linux.

ttyS0 and COM1

Thanks in advance!

10 replies

September 22, 2011

koahnig koahnig
Area 51 Engineer
2873 posts

the serial port is not directly supported by Qt. However, there is a project qextserialport [code.google.com] which shall help you in your task. There are also a couple of posts in this forum concerning the topic.
Go to tags [developer.qt.nokia.com] on this webpage and type qextserialport.

September 22, 2011

dvez43 dvez43
Ant Farmer
291 posts

hm, I have looked at the qextserialport library before. I just cant figure out how to first:

- Download the library – There is no tutorial on how to implement the library in the code

to bad qt doesn’t have it built in :/

Edit: I just got it downloaded, now I am looking at the examples to see if I can get it working. Thank you very much for the help again.

September 22, 2011

dvez43 dvez43
Ant Farmer
291 posts

Sorry for the double post. I am having trouble figuring out how add the library to my project.

I downloaded the source files from the svn. There doesnt seem to be a library file incorperated with the download.

Do you know of any tutorial on how to implement qextserialport into a project? or have you done it before?

the enumorator example that came with the download is perfect for what I need, I am just not sure how to get it to work…

Thanks

September 22, 2011

koahnig koahnig
Area 51 Engineer
2873 posts

The library you have create yourself. Or you just link the objects directly to your application.
I have used the lib (correction: I have used the code, but I did not bother to make a lib out of it), but I downloaded from Sourceforge sometime ago. It has been moved to google later.
Were you able to compile the examples?

September 22, 2011

dvez43 dvez43
Ant Farmer
291 posts

I opened the src.pro in the main folder and compiled it, which created the lib files.

Now I try to open the examples and they don’t run, it still says cannot find librarys.

Can I copy the librarys into a desired folder location within my new project, then just link the library’s?
That would require editing to the .pro file of my own project correct…?

September 22, 2011

koahnig koahnig
Area 51 Engineer
2873 posts

I have just checked the download I have. First, one correction I did compile as a lib, then I could compile and run the examples. However, I was not succeeding with one of the examples, unfortunately the enumerator example.
Did you try to compile the other examples?

BTW: I have used it on windows with vs2005.

September 22, 2011

Eddy Eddy
Gene Splicer
1520 posts

Moved to the installation subforum

 Signature 

Qt Certified Specialist
Nokia Qt Ambassador

September 22, 2011

dvez43 dvez43
Ant Farmer
291 posts

I built the qextserialport.pro file in the main folder in the Qtdesigner. I see the examples on the left. Alls I want to do is just use the serial port functionality in my application. What would be the easiest why to do this?

I havent started building my app yet. I have a blank project right now, but I would like to get the serial communication going first before I do anything.

September 22, 2011

dvez43 dvez43
Ant Farmer
291 posts

Also, I keep getting linking errors even when I try to run the examples…

/home/../../qextserialport-build-desktop-Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Release/examples/event/event: error while loading shared libraries: libqextserialport.so.1: cannot open shared object file: No such file or directory

September 23, 2011

uranusjr uranusjr
Lab Rat
84 posts

Qt Creator uses shadow building, and builds the lib files in another directory instead of the same directory of the source codes. Therefore, the .pro file for the QextSerialPort example fails to find the correct path. You have several ways to correct this:

1. Change the QMAKE_LIB variable in the .pro file of the example to point to the directory that contains the .so files

2. Turn off shadow building in both the library and the example, or use the console to build them.

3. Copy the .so files to your Qt installation’s lib path.

 
  ‹‹ Deploy on x86 device, from x86_64 linux host      How to get Qt Creator to build OpenGL (ES) 2.x programs? ››

You must log in to post a reply. Not a member yet? Register here!