INET: How to create an executable or static library?

517 views
Skip to first unread message

baukran

unread,
Aug 5, 2017, 7:37:12 AM8/5/17
to OMNeT++ Users
Hi,

I am using OMNeT++ 5.1. 

These are the steps I did:
- Install simulation models -> INET 3.6
- Build the INET project (using the default shared library option) and run an example, e.g. tcpsack. It works.
- In the properties of the INET project: OMNeT++ -> Makemake -> src:makemake -> Options -> Target -> Switch to "Exectuable" (from "Shared Library")
- Rebuild the project and run the same example again. When it starts I get the following error popup:
"Function firstAvailableOrEmpty() not found (Define_NED_Function() or Define_NED_Math_Function() missing from C++ code?), at /home/user/Documents/omnetpp-5.1/samples/inet/src/inet/node/inet/Router.ned:60 -- in module (omnetpp::cModule) tcpsack.router (id=2), during network setup"
- The same error message appears if I build the project as a static library and run the same example again.

How can I create an executable or static library using INET?

Best regards
Tobias

baukran

unread,
Aug 5, 2017, 3:20:21 PM8/5/17
to OMNeT++ Users
Ok, after the executable has been created, running a .ini in the IDE yields to the following command being executed:

opp_run -m -n ../../../examples:../..:../../../tutorials omnetppNC.ini

Since an executable has been created (and not a shared library) the option "-l ../path/to/INETSharedLib" is not included since an executable can't be linked to. Therefore the error.

What works is to call the executable from the command line:

 ./INET ../pathToIniini -n ../../../pathToNed

What probably should happen is that the IDE detects than an executable has been created and therefore adjust the invoked command, shouldn't it?

baukran

unread,
Aug 9, 2017, 3:07:41 PM8/9/17
to OMNeT++ Users
If I run my executable like this (for the reason see my older, cited email):
 
 ./INET ../pathToIniini -n ../../../pathToNed -debug-on-errors=true
 
Do you know how the debugger of the OMNeT++ IDE can be evoked?

Michael Kirsche

unread,
Aug 9, 2017, 4:21:22 PM8/9/17
to OMNeT++ Users
By customizing your "debug run configuration" ?!?
Probably just how every other project with an executable is debugged. I don't see the problem, does any specific error occur when you try to start a debug session for your simulation?

baukran

unread,
Aug 9, 2017, 4:39:48 PM8/9/17
to OMNeT++ Users
So far I've started the debugging process only from the inside of an IDE, in case of OMNeT++ with the OMNet++ IDE.

I've tried " ./INET ../pathToIniini -n ../../../pathToNed --debugger-attach-on-startup=true" which gives me

"Setting up Qtenv...

Starting debugger: nemiver --attach=5272 &
Waiting for the debugger to start up and attach to us; note that for the latter to work, some systems (e.g. Ubuntu) require debugging of non-child processes to be explicitly enabled.
sh: 1: nemiver: not found"

How can I resolve this? Would this start the debugger using the OMNeT++ IDE?

baukran

unread,
Aug 9, 2017, 4:51:04 PM8/9/17
to OMNeT++ Users
Sorry, I am a bit stressed. I installed nemiver. If I run "./INET ../pathToIniini -n ../../../pathToNed --debugger-attach-on-startup=true --debug-on-errors=true" nemiver opens. If I then run my simulation I get a "Segmentation fault (core dumped)" and the debugger closes. If I remember it correctly, when I used the debugger of the IDE, the debugger would not crash and I could figure out where the segmentation fault occurs 

baukran

unread,
Aug 9, 2017, 5:33:26 PM8/9/17
to OMNeT++ Users
Nevermind, I came to realize that I can create my custom configuration inside the IDE to run an executable... now I have access to the GUI debugger.

Michael Kirsche

unread,
Aug 10, 2017, 3:44:23 AM8/10/17
to OMNeT++ Users
That's what I meant :)
Glad it worked out.

asmaa.el...@gmail.com

unread,
Nov 14, 2017, 9:57:29 PM11/14/17
to OMNeT++ Users
Please Michael, i have a problem when i am going to run my simulation there is an error that the executable file not created and not process the debugging. do you know what is the problem and how to fix it?
thank you

Michael Kirsche

unread,
Nov 16, 2017, 3:50:09 PM11/16/17
to OMNeT++ Users
That is as general and non-informative as an error description can be.
Just like (for example): "My computer is not starting, do you know what is the problem?" --> no idea and no way to tell you whats wrong.

There can be tons of reasons why your simulation executable files are not created. Did you check that the compiler did actually successfully compile your project?
If no, go check the errors that the compiler reports and fix them.
If yes, check your project settings to see if you configured your project to be compiled as an executable.
If the files are not created, maybe you do not have writing privileges in the project folder...
Whatever it is, impossible to say without knowing more details, exact error messages, etc!
Reply all
Reply to author
Forward
0 new messages