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!
the serial port is not directly supported by Qt. However, there is a project "qextserialport":http://code.google.com/p/qextserialport/ which shall help you in your task. There are also a couple of posts in this forum concerning the topic.
Go to "tags":http://developer.qt.nokia.com/tags on this webpage and type qextserialport.
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.
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...
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?
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...?
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.
Moved to the installation subforum
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.
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
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:
Change the QMAKE_LIB variable in the .pro file of the example to point to the directory that contains the .so files
Turn off shadow building in both the library and the example, or use the console to build them.
Copy the .so files to your Qt installation's lib path.