Integrating ns3 with Qt

  • Hi,
    I am currently working on a project for which i have created two project files in IDE is using the ns3, a c/c++ application project and second one is Qt application project used for GUI purpose.I need to integrate them together or in simple words i want to call a function which is there in QT application project from a c/c++ application project.

    can anybody help me how to do that???thanks in advance for your help.

  • I have resolved that issue after spending some time.I am providing the solution so that it can be helpful to save time:

    In order to integrate ns3 and Qt, I;
    1)-created the dynamic library of the code written in Qt using IDE netbeans.
    2)-In order to link and use that library I place the header file in the build/project folder so that I can use it easily.After that to link the dynamic library in ns3, I added following lines in the script file:

    module.linkflag=['-g'] #module.install_path=['/home/a/Documents/ns-allinone-3.16/ns-3.16/src/propagation/QDynLib/dist/Debug/GNU-Linux-x86']

    Here,I used the absolute path to locate the dynamic library.

    Location of the Dynamic library;
    Name of the library File:

    to find the explanation and detail of these command please refer to the link:

  • Here is .pro format for NS3 integration(for anyone else in future):

    TEMPLATE = app
    CONFIG += console c++11
    CONFIG -= app_bundle
    CONFIG -= qt
    NS_BUILD_DIR = <path-to-ns3>/ns-3.26/build
    unix {
        SHARED_LIB_FILES = $$files($$NS_BUILD_DIR/*.so)
        for(FILE, SHARED_LIB_FILES) {
            BASENAME = $$basename(FILE)
            CLEARNAME = $$replace(BASENAME,libns,ns)
            CLEARNAME = $$replace(CLEARNAME,.so,)
            LIBS += -l$$CLEARNAME
    SOURCES += main.cpp

Log in to reply

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