1
votes

I'm simulating a network in OMNeT++, with INET framework. I have a compound module as network node, consisting of a simple module/node and the mobility module. I want to get the position of the node with the following code:

void node::initialize()
{
    cModule *host = getContainingNode(this);
    IMobility *mobility = check_and_cast<IMobility *>(host->getSubmodule("mobility"));
    Coord selfPosition = mobility->getCurrentPosition();
}

I've also included "inet/mobility/contract/IMobility.h".

It should be straightforward, but the build fails with the following:

../out/clang-release/src/node.o:(.text[_ZN7omnetpp14check_and_castIPN4inet9IMobilityENS_7cModuleEEET_PT0_]+0x18): undefined reference to `__imp__ZTIN4inet9IMobilityE'
../out/clang-release/src/node.o:(.rdata[_ZTIPN4inet9IMobilityE]+0x18): undefined reference to `typeinfo for inet::IMobility'

I understand that this has something to do with the compiler, but it's not clear how I can solve this within OMNeT++ environment. Any ideas?

1
Is your project a standalone project referenced to INET?Jerzy D.
Yes it is Jersy.dkomna

1 Answers

1
votes

I found a workaround in case someone is interested. I changed the compiler from clang to gcc and it worked. In order to do this:

  1. Navigate to the root folder of OMNeT++
  2. Edit file "configure.user" and uncomment the line "CC=gcc" (the line is located near the top of the file)
  3. Run mingwenv.cmd (a new command window will open)
  4. Execute commands "./configure" and "make"

This sequence changes compiler from clang to gcc, recompiles resources and fixes the problem.

I have to stress that I'm on Windows 10. The same problem should not be noticed in Linux, where the default compiler should be gcc.

As far as the root of the problem is concerned, it probably has to do something with a flag concerning RTTI (Run Time Type Information), which should be enabled for compilation. I didn't manage to enable this for clang within OMNeT++, but changing the compiler did the trick.