Important: Please read the Qt Code of Conduct -

Libtins in Qt

  • Hi,
    When i include libtins library in qt version 4.8 project file as follows:

    QT       += core
    QT       -= gui
    TARGET = test
    CONFIG   += console
    CONFIG   -= app_bundle
    TEMPLATE = app
    INCLUDEPATH +=include
    LIBS += tins.lib
    SOURCES += main.cpp

    i have already included the include and lib file in the folder test..
    main file of this test project looks like this:

    #include <QtCore/QCoreApplication>
    #include <iostream>
    #include <tins/tins.h>
    using namespace Tins;
    bool callback(const PDU &pdu) {
        const IP &ip = pdu.rfind_pdu<IP>(); // Find the IP layer
        const TCP &tcp = pdu.rfind_pdu<TCP>(); // Find the TCP layer
        std::cout << ip.src_addr() << ':' << << " -> "
                  << ip.dst_addr() << ':' << tcp.dport() << std::endl;
        return true;
    int main(int argc, char *argv[])
        QCoreApplication a(argc, argv);
        return a.exec();

    and i am getting undefined reference errors as follows

    In function Z8callbackRKN4Tins3PDUE': test\main.cpp:12: error: undefined reference to_imp___ZN4TinslsERSoRKNS_11IPv4AddressE'
    test\main.cpp:20: error: undefined reference to _imp___ZN4Tins7SnifferC1ERKSsNS0_12promisc_typeES2_b' test\include\tins\ip.h:389: error: undefined reference to_imp___ZN4Tins11IPv4AddressC1Ej'
    can anyone propose a solution for that......

    Thank u

  • Lifetime Qt Champion

    @Nisha Did you try to put whole path to the lib like:

    LIBS += c:/mylibs/tins.lib

    Is that lib built using the same compiler? On Windows the lib must be built using EXACT the same compiler.

  • Moderators

    also make sure that you rerun qmake once you make changes to your .pro file.

Log in to reply