Creating and adding a static library

  • Hi,
    I am using qt on windows now. I need to add the serial port library ( First I build the library using the CONFIG += staticlib option and get a library with an extension with .a .Now I try to add the library to some example programs given in the event directory. I also add CONFIG += staticlib in the .pro file, but I always get errors like
    @qextserialport\examples\event-build-desktop/../event/PortListener.cpp:11: undefined reference to `_imp___ZN14QextSerialPort9setParityE10ParityType'@

    I think there is some linking issues, because it will work when linking with dll files, how to solve?

  • Please post your .pro file for the project that is not linking properly and could you let us know where the statically compiled library is located please?

  • Hi,
    Here is the complete project code ( ), in which I tried the project in the examples/event folder, i.e

    PROJECT = event
    TEMPLATE = app
    INCLUDEPATH += ../../src
    QMAKE_LIBDIR += ../../src-build-desktop/build
    CONFIG += staticlib

    OBJECTS_DIR = tmp
    MOC_DIR = tmp
    UI_DIR = tmp

    SOURCES += main.cpp PortListener.cpp
    HEADERS += PortListener.h

    CONFIG(debug, debug|release):LIBS += -lqextserialportd
    else:LIBS += -lqextserialport
    I am using Qt libraries version 4.7.0, Qt Creator IDE version 2.0.1 in Windows
    Thanking You,

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.