Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. [Solved] Problem with Qextserialport doesn’t work the library
Forum Update on Monday, May 27th 2025

[Solved] Problem with Qextserialport doesn’t work the library

Scheduled Pinned Locked Moved 3rd Party Software
12 Posts 5 Posters 12.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    smallsea
    wrote on last edited by
    #3

    But the path of library is in the 17line with LIBS
    @
    CONFIG(debug, debug|release):LIBS += -lqextserialportd
    else:LIBS += -lqextserialport
    @
    I have change also
    QMAKE_LIBDIR += ../../build
    in
    QMAKE_LIBDIR += .

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #4

      Pathes to libraries are specified with -L, the libraries itself with -l.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        smallsea
        wrote on last edited by
        #5

        Okey thk but now I have another problem, when compile this program:
        @#include <stdio.h>
        #include <qextserialenumerator.h>

        int main(int argc, char *argv[])
        {
        QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
        printf("List of ports:\n");
        for (int i = 0; i < ports.size(); i++) {
        printf("port name: %s\n", ports.at(i).portName.toLocal8Bit().constData());
        printf("friendly name: %s\n", ports.at(i).friendName.toLocal8Bit().constData());
        printf("physical name: %s\n", ports.at(i).physName.toLocal8Bit().constData());
        printf("enumerator name: %s\n", ports.at(i).enumName.toLocal8Bit().constData());
        printf("===================================\n\n");
        }
        return EXIT_SUCCESS;
        }@

        return this error
        C:\Users\Alessio\Desktop\qextserialport-1.2win-alpha\examples\enumerator-build-desktop..\enumerator\main.cpp:11: error: undefined reference to `QextSerialEnumerator::getPorts()'

        but when I double-click + ctrl on QextSerialEnumerator I read the source file...

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Scylla
          wrote on last edited by
          #6

          bq. return this error
          C:\Users\Alessio\Desktop\qextserialport-1.2win-alpha\examples\enumerator-build-desktop..\enumerator\main.cpp:11: error: undefined reference to `QextSerialEnumerator::getPorts()’
          but when I double-click + ctrl on QextSerialEnumerator I read the source file…

          It looks like the lib isn't linked! That mean the settings in your pro file are not correct. Show you actual pro file.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            smallsea
            wrote on last edited by
            #7

            This is *.pro
            @PROJECT = enumerator
            TEMPLATE = app
            DEPENDPATH += .
            INCLUDEPATH += .
            QMAKE_LIBDIR += .

            OBJECTS_DIR = obj
            MOC_DIR = moc
            UI_DIR = uic
            CONFIG += qt warn_on console

            SOURCES += main.cpp

            CONFIG(debug, debug|release):LIBS += -Lqextserialportd
            else:LIBS += -Lqextserialport

            unix:DEFINES = TTY_POSIX
            win32:DEFINES = TTY_WIN@
            and qextserialportd.dll and libqextserialportd.a are in tha same folder of project

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Scylla
              wrote on last edited by
              #8

              bq. else:LIBS += -Lqextserialport

              This doesn't work. You have to set the path to lib i.e "-L/path/to/the/lib" and link the lib i.e. "-lqextserialport".

              1 Reply Last reply
              0
              • S Offline
                S Offline
                smallsea
                wrote on last edited by
                #9

                sorry but I don't understand. who is the correct definition of librery...

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lgeyer
                  wrote on last edited by
                  #10

                  Using LIBS you can pass two types of information

                  • a list of pathes in which the linker should search for libraries, using -L (uppercase)
                  • a list of libraries the linker should use, using -l (lowercase)

                  To add a library you usually have to specifiy both unless the library resides in a system-wide directory (/usr/lib for example).

                  @
                  LIBS += -L<path to your library without library name, for example /usr/lib/qt> -l<library name without path to your library, for example qextserialport>
                  @

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    justdad
                    wrote on last edited by
                    #11

                    Here is a long description of what I had to do to get everything to work over the last several days. Hope someone can gain from my pain. :)

                    When I wanted to build within the serial port files in Creator I had to do the following things on the latest version of QT

                    You need to copy the file qwineventnotifier_p.h from the source to the correct location as mentioned in other places. (Google it)

                    Building the SRC files for the DLL (qextserialport.dll, qextserialportd.dll)

                    Load the src.pro fil into Creator
                    To build a the correct debug file and never have a problem , I had to change the CONFIG line in the src.pro file from

                    CONFIG += qt warn_on debug_and_release
                    To
                    CONFIG += qt warn_on debug

                    And to build a release version I had to use
                    CONFIG += qt warn_on release

                    The above allowed me to build both versions of the DLL file needed by the other programs. It took two steps but I wasn't changing the code here so it wasn't really an issue and it worked consistantly.

                    Building the different apps.

                    The default path to my projects including the “src” files wanted to be src-build-desktop and not just build. This has something to do with my creator
                    settings I am sure, but I do not know how to fix it.

                    This means in your “enumerator”, “event” and “qespta” .PRO files you need to change the path of the serial library by doing the following.

                    #QMAKE_LIBDIR += ../../src/build
                    QMAKE_LIBDIR += ../../src-build-desktop/build

                    This would allow me to compile correctly. However, when I wanted to run, I would get run time errors. Some mentioned above

                    I solved this by copying the (qextserialport.dll, qextserialportd.dll) files to the location of my executable. Once I did this I was able to run correctly.
                    I probably need to place the DLL files in the system directory but for now, this worked.

                    I hope the above helps others as it took me several hours over several days to figure this out from different threads and trial and error.

                    Ken

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      justdad
                      wrote on last edited by
                      #12

                      One other thing, no spaces in any of the directory names. This can cause weird issues as well.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved