Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Libtins in Qt
Qt 6.11 is out! See what's new in the release blog

Libtins in Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 2.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.
  • N Offline
    N Offline
    Nisha
    wrote on last edited by p3c0
    #1

    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:
    main.cpp

    #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() << ':' << tcp.sport() << " -> "
                  << ip.dst_addr() << ':' << tcp.dport() << std::endl;
        return true;
    }
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        Sniffer("eth0").sniff_loop(callback);
        
        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'
    etc.........
    can anyone propose a solution for that......

    Thank u

    jsulmJ raven-worxR 2 Replies Last reply
    0
    • N Nisha

      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:
      main.cpp

      #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() << ':' << tcp.sport() << " -> "
                    << ip.dst_addr() << ':' << tcp.dport() << std::endl;
          return true;
      }
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          Sniffer("eth0").sniff_loop(callback);
          
          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'
      etc.........
      can anyone propose a solution for that......

      Thank u

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @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.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • N Nisha

        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:
        main.cpp

        #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() << ':' << tcp.sport() << " -> "
                      << ip.dst_addr() << ':' << tcp.dport() << std::endl;
            return true;
        }
        
        int main(int argc, char *argv[])
        {
            QCoreApplication a(argc, argv);
        
            Sniffer("eth0").sniff_loop(callback);
            
            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'
        etc.........
        can anyone propose a solution for that......

        Thank u

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

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

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        2

        • Login

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