Error when running INET simulations with embedded Omnet++.

623 views
Skip to first unread message

l.giacomoni

unread,
Oct 11, 2017, 7:31:37 AM10/11/17
to OMNeT++ Users
Hi everyone,

I am trying to simulate some of INET's models with Omnet++ embedded in my own application. I am following the example given in the manual under the section Embedding. The OS I am working on is Ubuntu 16.04.

When I try to run my project I get the following error:

"terminate called after throwing an instance of 'omnetpp::cRuntimeError'
  what():  Function firstAvailableOrEmpty() not found (Define_NED_Function() or Define_NED_Math_Function() missing from C++ code?), at [somepath]/inet/src/inet/node/inet/StandardHost.ned:59"

It seems the application cannot find the implementation of firstAvailableOrEmpty() - I eventually found out that it cannot find the module classes either outputting a similar error about Register_Class().

I am building and running on Netbeans and I have linked the libINET.so library to my project, but it seems that Omnet++ cannot find the implemtations of NED functions and modules. 

My code is basically identical to the code provided in the example.

Is there anything I am missing here in the linking process of my application to the libINET.so?

Thanks a lot for your inputs.

Best regards,
Luca

Alfonso Ariza Quintana

unread,
Oct 11, 2017, 11:17:29 AM10/11/17
to omn...@googlegroups.com

What inet version are you using? It is possible that the version that you are using doesn’t include it.

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
Visit this group at https://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

l.giacomoni

unread,
Oct 11, 2017, 11:42:15 AM10/11/17
to OMNeT++ Users
Version 3.6.0

I have forgotten to mention that I have been running the same simulations as standalone executables with no problem.

The problem occurs when loading NED files to simulate in another application. 

Alfonso Ariza Quintana

unread,
Oct 11, 2017, 11:49:42 AM10/11/17
to omn...@googlegroups.com

The function should be in the file src/common/NedFuntions.cc.

It is possible that the linker could have failed.

 

It is possible to check in the so library if the function is available. Open the binary in the ide and check in the libinet.so file if the function is present, it should be in the file NedFuntions.cc and the function is called in the library like nedf_firstAvailableOrEmpty.

l.giacomoni

unread,
Oct 11, 2017, 12:17:50 PM10/11/17
to OMNeT++ Users
Yes, I checked earlier and the function was in the library. In fact, I use the same library to run my simulation executable with no problem. 

If it can help, the output of compiling is:

g++ -I[somepath]/omnetpp-5.1.1/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.o" -o "main.o" "../main.cc"

whereas the output of linking is:

g++ -L[somepath]/inet/src -L[somepath]/omnetpp-5.1.1/lib -o "example"  ./main.o   -lINET -loppsimd -loppsim -loppscaved -loppscave -loppqtenvd -loppqtenv -loppnedxmld -loppnedxml -loppmaind -loppmain -lopplayoutd -lopplayout -loppeventlogd -loppeventlog -loppenvird -loppenvir -loppcommond -loppcommon -loppcmdenvd -loppcmdenv

I wonder if there are some options that I am missing out?

Thanks again.

l.giacomoni

unread,
Oct 13, 2017, 10:32:03 AM10/13/17
to OMNeT++ Users
As this might be of interest to other people, I have solved the problem by using opp_makemake to generate my Makefile, with appropriate options to pass extra libraries (i.e. inet) and headers.

Before doing so, I was using the autogenerated Makefile and during execution my application wasn't able to find any registered NED function or any registered class - not really sure why. 

Alfonso Ariza Quintana

unread,
Oct 16, 2017, 4:28:21 AM10/16/17
to omn...@googlegroups.com

Have you tries to build the executable from the IDE?

l.giacomoni

unread,
Oct 18, 2017, 5:35:52 AM10/18/17
to OMNeT++ Users
Yes, that is what I was doing before.

From the Project Settings I was enabling the autogeneration of the Makefile and then build the project. The libs and includes are specified in the projects settings, too. During execution, though, the application cannot solve NED Functions or classes.
Reply all
Reply to author
Forward
0 new messages