Create a simple RS232 interface
-
Hello Jalomic,
Thanks for your reply.
do you mean include the lib like following?
#This are the to line you have to add
INCLUDEPATH += C:/Qt/qextserialport-1.2win-alpha/
LIBS += -L“C:/Qt/qextserialport-1.2win-alpha/build/” -libqextserialportd.aThe result still the same.
Actually is C:/ or C:\ ? normally the format is C:\Qt\qextserialport-1.2win-alpha\build from our pc.
The sample given is a bit confuse ya.. -
No ! Just copy and paste this:
LIBS += -L“C:/Qt/qextserialport-1.2win-alpha/build/” -lqextserialportor like this:
LIBS += -L“C:/Qt/qextserialport-1.2win-alpha/build/” -llibqextserialportd.a-L - it is prefix for path to library folder
-l - prefix for lib file -
Now my code look like this way:
@#-------------------------------------------------
Project created by QtCreator 2011-06-18T12:45:21
#-------------------------------------------------
QT += core gui
TARGET = portcomsender
TEMPLATE = appThis are the to line you have to add
INCLUDEPATH += C:/Qt/qextserialport-1.2win-alpha/
LIBS += -L“C:/Qt/qextserialport-1.2win-alpha/build/” -llibqextserialportd.aSOURCES += main.cpp
widget.cppHEADERS += widget.h@
after compiled the result still show
Error while building project portcomsender (target: Bureau)
When executing build step ‘qmake’ -
I found the build setting on left corner, is it something wrong with my build setting? I did tried 4 difference setting but result still the same.
4.7.0 Debug
4.7.0 Release
Qt 4.7.3 for Desktop - MinGW 4.4 (Qt SDK) Debug
Qt 4.7.3 for Desktop - MinGW 4.4 (Qt SDK) Release -
http://imageshack.us/photo/my-images/203/buildn.jpg/
ok, Can you see the image? I think a bit too small for you. -
When i unzip the file and double click the portcomsender.pro project file it prompt out this dialog.
!http://i.imgur.com/H1iY5.jpg(Build2)!
Is it this the issue?
How can i use his .cpp and .h file to create my own project environmental?
-
You should not use old .user files. Delete this file before opening a copied project.
-
You can also consider testing the official Qt Playground project: "QtSerialPort":https://qt.gitorious.org/qtplayground/qtserialport.
-
Hello Sierdzio,
Thanks for your advice. Ya, in the folder i found this portcomsender.pro.user file. After deleted and open the project file again the dialog never prompt out anymore.
After this will ask for Target setup. I configured:
Desktop - Tick
Create Build Configurations: For Each Qt Version One Debug And One Release
Use Shadow Building - Tick
Click Finishhttp://i.imgur.com/fUYLq.jpg
I try compile and there are few error prompt out. The image shows the error message.emmm...The program look not so complicated but when compile that time is not that easy.
Is it possible to help me to create a sample project so that i can have a reference and easy for me to check where's the error?
This sample tutorial i get it from http://www.instructables.com/id/Control-your-arduino-from-your-PC-with-the-Qt-Gui/step3/Lets-program/Thank you very much, I will test QtSerialPort later. It's quite interested to have working sample to test. This sample code is not a tutorial i guess it should be least explanation, hopefully i can understand the coding. I have C programming knowledge but lack C++ and this the first time i try windows programming. :)
Let me have a try first ya...Any question i will come back again..
Best Regards,
Qt52 -
You have got some missing includes - this is still all about LIBS and INCLUDEPATH in .pro file. I know it's hard to get right the first time you try. Maybe if you are new to this all, it would be better to try something using Qt classes only? You can take a look at example of including custom libs in my "QEasyShell":https://github.com/sierdzio/qeasyshell/blob/master/examples/basic/basic.pro project, but I'm using .pri so I'm not sure it will make it easier for you... although it might. Just be sure to read the global.pri in addition to the one I've linked.
-
Hey bro ..m a newbie trying exactly the same program from instructables..
In the desktop prompt as mentioned in step 2 for controlling arduino using qt gui... i am getting the following error..please help if you have fixed the isse you were facing..thnxC:\Qt\qextserialport-1.2win-alpha>C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\mingw32-ma
ke.exe
C:/Qt/Qt5.3.0/Tools/mingw482_32/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Qt/qextserialport-1.2win-alpha'
g++ -c -pipe -fno-keep-inline-dllexport -O2 -Wall -Wextra -frtti -fexceptions -m
threads -DUNICODE -D_TTY_WIN_ -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I'../Qt5.3.0/5.3/
mingw482_32/include' -I'../Qt5.3.0/5.3/mingw482_32/include/QtCore' -I'build/moc'
-I'../Qt5.3.0/5.3/mingw482_32/mkspecs/win32-g++' -o build/obj/win_qextserialpor
t.o win_qextserialport.cpp
win_qextserialport.cpp: In member function 'virtual bool Win_QextSerialPort::ope
n(QIODevice::OpenMode)':
win_qextserialport.cpp:187:37: error: 'class QString' has no member named 'toAsc
ii'
Win_Handle=CreateFileA(port.toAscii(), GENERIC_READ|GENERIC_WRITE,
^
win_qextserialport.cpp: At global scope:
win_qextserialport.cpp:431:6: warning: unused parameter 'c' [-Wunused-parameter]void Win_QextSerialPort::ungetChar(char c) {
^
win_qextserialport.cpp:948:6: warning: unused parameter 'msecs' [-Wunused-parame
ter]
bool Win_QextSerialPort::waitForReadyRead(int msecs)
^
win_qextserialport.cpp: In member function 'void Win_QextSerialPort::monitorComm
Event()':
win_qextserialport.cpp:988:6: warning: suggest explicit braces to avoid ambiguou
s 'else' [-Wparentheses]
if (eventMask & EV_DSR)
^
Makefile.Release:538: recipe for target 'build/obj/win_qextserialport.o' failed
mingw32-make[1]: *** [build/obj/win_qextserialport.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/qextserialport-1.2win-alpha'
Makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2C:\Qt\qextserialport-1.2win-alpha>
thanks
Harshit arora
urgent reply needed...
[quote author="qt52" date="1352892591"]Hello Sierdzio,
Thanks for your advice. Ya, in the folder i found this portcomsender.pro.user file. After deleted and open the project file again the dialog never prompt out anymore.
After this will ask for Target setup. I configured:
Desktop - Tick
Create Build Configurations: For Each Qt Version One Debug And One Release
Use Shadow Building - Tick
Click Finishhttp://i.imgur.com/fUYLq.jpg
I try compile and there are few error prompt out. The image shows the error message.emmm...The program look not so complicated but when compile that time is not that easy.
Is it possible to help me to create a sample project so that i can have a reference and easy for me to check where's the error?
This sample tutorial i get it from http://www.instructables.com/id/Control-your-arduino-from-your-PC-with-the-Qt-Gui/step3/Lets-program/Thank you very much, I will test QtSerialPort later. It's quite interested to have working sample to test. This sample code is not a tutorial i guess it should be least explanation, hopefully i can understand the coding. I have C programming knowledge but lack C++ and this the first time i try windows programming. :)
Let me have a try first ya...Any question i will come back again..
Best Regards,
Qt52[/quote]
-
2 harshit_smart,
instead of QextSerialPort you can use the QtSerialPort in your Qt5.3. The QtSerialPort is an part of an official Qt add-on package. To install it (using an official Qt installer) is enough to expand an "Addons" checkbox and to select "SerialPort" component.
-
Thanks for awaited reply ...Ill surely try that right now...but will the program work thats given in the 3rd step of instructable for connecting arduino to qt gui???
[quote author="kuzulis" date="1401795947"]2 harshit_smart,
instead of QextSerialPort you can use the QtSerialPort in your Qt5.3. The QtSerialPort is an part of an official Qt add-on package. To install it (using an official Qt installer) is enough to expand an "Addons" checkbox and to select "SerialPort" component. [/quote]