[Solved] Adding QtSerialPort to 4.6.3
-
Added #include <algorithm> .... and moving further
-
I think I am missing this step because the libraries are built but not installed:
- add a new make “Build Step” and write to the “Make arguments” the install target
... I am not really sure how to do this ?!?
-
... found it:
- Switch to Projects Mode: press Ctrl+5.
- On Build Settings tab under Build Steps click on Add Build Step.
- Choose Make from the menu.
- Write install into Make arguments: text input box.
.. libraries are installed in local 4.6.3 on windows. :)
... moving forward ... -
Including into a new empty project does not work, returning:
@release/main.o:main.cpp:(.text+0x66): undefined reference to_imp___ZN15QSerialPortInfo14availablePortsEv' release/main.o:main.cpp:(.text+0xf9): undefined reference to
_imp___ZNK15QSerialPortInfo8portNameEv'
release/main.o:main.cpp:(.text+0x23b): undefined reference to_imp___ZNK15QSerialPortInfo11descriptionEv' release/main.o:main.cpp:(.text+0x374): undefined reference to
_imp___ZNK15QSerialPortInfo12manufacturerEv'
release/main.o:main.cpp:(.text+0x4ab): undefined reference to_imp___ZN11QSerialPortC1EP7QObject' release/main.o:main.cpp:(.text+0x4be): undefined reference to
_imp___ZN11QSerialPort7setPortERK15QSerialPortInfo'
release/main.o:main.cpp:(.text+0x4d5): undefined reference to_imp___ZN11QSerialPort4openE6QFlagsIN9QIODevice12OpenModeFlagEE' release/main.o:main.cpp:(.text+0x4e2): undefined reference to
_imp___ZN11QSerialPort5closeEv'
release/main.o:main.cpp:(.text+0x4eb): undefined reference to_imp___ZN11QSerialPortD1Ev' release/main.o:main.cpp:(.text+0x94a): undefined reference to
_imp___ZN11QSerialPortD1Ev'
release/main.o:main.cpp:(.text$_ZN5QListI15QSerialPortInfoE4freeEPN9QListData4DataE[QList<QSerialPortInfo>::free(QListData::Data*)]+0x36): undefined reference to_imp___ZN15QSerialPortInfoD1Ev' release/main.o:main.cpp:(.text$_ZN5QListI15QSerialPortInfoE13detach_helperEv[QList<QSerialPortInfo>::detach_helper()]+0x68): undefined reference to
imp___ZN15QSerialPortInfoC1ERKS'
release/main.o:main.cpp:(.text$_ZN5QListI15QSerialPortInfoE13detach_helperEv[QList<QSerialPortInfo>::detach_helper()]+0xb6): undefined reference to `_imp___ZN15QSerialPortInfoD1Ev'
@It installed .dll to /bin, .h to /include/QtSerialPort, .a, lib.dll and .prl to /lib. So far, this seems ok to me but it still returns the errors above.
Any idea?
-
Found it. If its done like in the wiki with adding
@CONFIG += serialport@to the pro, it does not work.
I had to manually copy the prf from the sources and add:@include(C:\QtSDK\Desktop\Qt\4.6.3\lib\serialport.prf)@
to the pro file (for what ever this file is for ?!?)
Finally, it runs under windows ... now I'll try to port it to my eLinux environment .. which will be trickier, I assume. -
The serialport.prf should be in \mkspecs\features\ in your Qt place. Then CONFIG += serialport should be work correctly.
-
Perfect! Thanks a lot.
Now .. moving to Linux ... I'll keep this thread updated -
Needed some changes to the sources. However, one line of code still bugs me:
@const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime());@
msecsTo is not available in QDateTime in 4.6.3.
Any idea? -
You can do not use QLockFile.. Just exclude this module/code from compilation (e.g. comments out some places and so on).
-
Thanks. Decided to replace
@const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime());
return staleLockTime > 0 && age > staleLockTime;
@
with
@return staleLockTime > 0 && (QDateTime::currentDateTime() > QFileInfo(fileName).lastModified().addMSecs(staleLockTime));@It works! :)
Just compiled for my eLinux and used the basics from the wiki reading out port names. Going to replace qextserialport with QtSerialPort now and hope it helpes in solving my communication issue.Thanks for your support and patience.
-
[quote author="McLion" date="1404925315"]Found it. If its done like in the wiki with adding
@CONFIG += serialport@to the pro, it does not work.
I had to manually copy the prf from the sources and add:@include(C:\QtSDK\Desktop\Qt\4.6.3\lib\serialport.prf)@
to the pro file (for what ever this file is for ?!?)
Finally, it runs under windows ... now I'll try to port it to my eLinux environment .. which will be trickier, I assume.
[/quote]Did the same, althought serialport.prf is in mkspec/features directory and I've added CONFIG += serialport in *.pro file. Works as intended
-
[quote author="McLion" date="1404925315"]Found it. If its done like in the wiki with adding
@CONFIG += serialport@to the pro, it does not work.
I had to manually copy the prf from the sources and add:@include(C:\QtSDK\Desktop\Qt\4.6.3\lib\serialport.prf)@
to the pro file (for what ever this file is for ?!?)
Finally, it runs under windows ... now I'll try to port it to my eLinux environment .. which will be trickier, I assume.
[/quote]Did the same, althought serialport.prf is in mkspec/features directory and I've added CONFIG += serialport in *.pro file. Works as intended