Results 1 to 5 of 5

Thread: QT4 and QextSerialPort / QextSerialenumerator

  1. #1
    Join Date
    Dec 2007
    Posts
    33
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QT4 and QextSerialPort / QextSerialenumerator

    Hi,

    i am trying to create a Windows-App, based on QT & QextSerialPort which should finaly be used to control a digital power supply.

    Basicly the Qt-Core (UI, core-functions etc..) does work and now i need to integrate QextSerialPort into my project.

    I would like to use QextSerialEnumerator (part of the latest QextSerialPort) to check the Windows host system for existing serial ports in the first step. The enumerator example does that in a very basic method. Based on that source i want to do my first step and add this function to my application.

    quote out of the enumerator example:
    Qt Code:
    1. QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
    2. printf("List of ports:\n");
    3. for (int i = 0; i < ports.size(); i++)
    4. {
    5. printf("port name: %s\n", ports.at(i).portName.toLocal8Bit().constData());
    6. printf("friendly name: %s\n", ports.at(i).friendName.toLocal8Bit().constData());
    7. printf("physical name: %s\n", ports.at(i).physName.toLocal8Bit().constData());
    8. printf("enumerator name: %s\n", ports.at(i).enumName.toLocal8Bit().constData());
    9. printf("===================================\n\n");
    10. }
    To copy to clipboard, switch view to plain text mode 
    I have compiled the enumerator example which works as standalone app.
    Well now...howto include it

    To be honest...i am wondering what is the best way to integrate 3rd-party source to my environment.

    Is it possible to create a custom folder which contains all QextSerialPort related files and just include them to my project (.pro file i guess) or should i start somehow different ?

    Hints are highly appreciated.
    best regards
    ape

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT4 and QextSerialPort / QextSerialenumerator

    You should compile extserialport as a library (shared or static) and link against it just like you link against Qt libraries.

  3. #3
    Join Date
    Dec 2007
    Posts
    33
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QT4 and QextSerialPort / QextSerialenumerator

    hi wysota,

    i have compiled qextserialport which ended in:

    * libqextserialport.a
    * qextserialport.dll

    The linking is my problem as c++ starter i guess.
    I am not sure if i need to reference this QT-external lib via my .pro file or how-else i should continue

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT4 and QextSerialPort / QextSerialenumerator

    Add LIBS+= -lqextserialport to your project file, rerun qmake and recompile the application. Make sure the .dll is accessible for the linker both at compile and at runtime (i.e. in the current working directory or in the path in case of windows).

  5. #5
    Join Date
    Dec 2007
    Posts
    33
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QT4 and QextSerialPort / QextSerialenumerator

    Hi wysota,

    basicly i tried that already.
    I did a second test like you told me.

    Re-adding:
    >> LIBS+= -lqextserialport
    to myproject.pro

    Copying the qextserialport.dll into a folder which is Part of my Windows Path Env.

    Re-Run qmake & make....and i have the following problem/output:
    *** qmake ***
    *** make ***
    mingw32-make -f Makefile.Release
    mingw32-make[1]: Entering directory `C:/myprojectfolder'
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o "release\myproject.exe" release\mainwindow.o release\main.o release\moc_mainwindow.o release\qrc_flash_tool.o -L"c:\Qt\4.3.2\lib" -lmingw32 -lqtmain release\flash_tool_res.o -lqextserialport -lQtGui4 -lQtCore4
    mingw32-make[1]: Leaving directory `C:/myprojectfolder'
    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\ mingw32\bin\ld.exe: cannot find -lqextserialport
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [release\myapp.exe] Error 1
    mingw32-make: *** [release] Error 2
    Done building. Press F4 to go to any errors.

    i continued with some comparison of the example project .pro file and mine and i guess that is the key.


    EDIT: yes problem is solved.
    Last edited by jacek; 30th January 2008 at 14:48. Reason: changed [code] to [quote]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.