Integrating ns3 with Qt
-
Hi,
I am currently working on a project for which i have created two project files in IDE Netbeans.one 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.ccflags=['-wall','-O3']
module.lib=['QDynLib']
module.libpath=['/home/a/Documents/ns-allinone-3.16/ns-3.16/src/propagation/QDynLib/dist/Debug/GNU-Linux-x86']
module.linkflag=['-g'] #module.install_path=['/home/a/Documents/ns-allinone-3.16/ns-3.16/src/propagation/QDynLib/dist/Debug/GNU-Linux-x86']
module.rpath=['/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;
/home/a/Documents/ns-allinone-3.16/ns-3.16/src/propagation/QDynLib/dist/Debug/GNU-Linux-x86/
Name of the library File:
libQDynLib.soto find the explanation and detail of these command please refer to the link:
http://docs.waf.googlecode.com/git/book_15/single.html#_c_and_c_projects -
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 LIBS += -L$$NS_BUILD_DIR INCLUDEPATH += $$NS_BUILD_DIR 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
-