Search code examples
c++staticsimulatoromnet++crypto++

OMNeT++ Simulator doesn't update if I target static library to link


I'm new to OMNeT++, and I'm trying to link Crypto++5.6.5 to OMNeT++5.1.1. The only way that OMNeT++ seems to allow me to link the Crypto++ library is using the static version of the Crypto++ library like I describe below:

  • Right clicking on Project->Properties->OMNeT++->Makemake->Option, from "Target" I choose "Static Library(.lib or .a)"
  • From "Compile" I choose the directory where cryptlib.lib is located (C:\cryptopp565\Win32\DLL_Output\Debug)
  • From "Link" I choose the additional library "cryptlib". (The actual library file is "cryptlib.lib")

All my encryption errors go away (so it seems like my crypto library is linked) and I can run the simulator, but the problem is when I run the simulation, the simulation hasn't updated from when I previously ran the simulator. I know I'm seeing the simulator run my previous (old) version of my project, from before I included a static library, because my old debug output plays even though I change the debug output using "EV<<...".

I don't think putting encryption into a simulator is a great idea, BUT this static-library-executing-old-simulator problem seems to happen regardless of what library I connect. So long as I select "Static Library(.lib or .a)" from the Target makemake page, even if I don't include a static library, the simulator doesn't update. When I go back to "Target Type"->"Executable" and build/run the simulator (and get rid of my link & compile to cryptlib), the most up-to-date project gets simulated, but my crypto library isn't linked.

Can anyone help me fix my settings so the OMNeT++ simulator runs my most recently built project when I target a static library?

Here's a picture of how I target static library

Here are h files included in my .cc file


Solution

  • There is some confusion here. Based on the images you've attached, you switched your project to create a static library. A static library is NOT executable so I'm not sure what you are actually running. At the end of the build process you will get your Anotherthy.a file, but that's just a library that you can link to an other executable sometimes in the future.

    Because of this (i.e. no executable is generated) you are probably running the last executable you have created (before switching to static lib). Long story short:

    You must build an executable or at least a shared library to be able to run it... Static library won't do.

    As for the original problem, if I see it right, you are trying to link a 32bit library of crypto++? Because OMNeT++ 5.1 is 64-bit only.