1

I have an OMNET++ project, CSW, that references other OMNET++ projects via Project->Properties->Project References.

The reference to the project CB_CSW_Vehicle works fine. I marked for this project Project->Properties->OMNET++->Makemake->Options->Target as shared library. So I have a libCB_CSW_Vehicle.dll, which is used by the main project CSW. Simulations from CSW run, using CB_CSW_Vehicle without problems.

The reference to the other project CB_CSW_Cloud, doesn't work. I made the same steps for it:

  1. marked "create shared library" in OMNET++->Makemake->Options->Target
  2. checked the project CB_CSW_Cloud in Properties->Project References of the main project

I can build my main project CSW. I can also build libCB_CSW_Cloud.dll. When I run a simulation from project CSW, I receive an error:

<!> Error during startup: Cannot load library '../../../CB_CSW_Cloud/src//libCB_CSW_Cloud.dll': The operation completed successfully.

The only difference between these two projects, is that CB_CSW_Cloud uses sqlite3 library. I added it to the project with following steps:

  1. set Project->Properties->OMNET++->Makemake->Options->Link->Additional Libraries to link with (-l option): sqlite3
  2. set Project->Properties->C/C++General->Paths And Symbols->Library Paths: C:/sqlite

Since I don't receive some exact information, why libCB_CSW_Cloud was not loaded, I don't know what causes the problem. I use it in exactly the same way, as other project CB_CSW_Vehicle, that works. This leads me to the suggestion, that the sqlite3 library causes the problem. Is it possible? Can a project CSW have a reference to the other project CB_CSW_Cloud, that itself uses a library sqlite3? Or shall I also add this library to CSW?

Can you help me to run the CSW project?

Update: I solved my problem with adding sqlite3 library to the run configuration and copying the source code of the CB_CSW_Cloud and CB_CSW_Vehicle projects to the CSW project. It is really difficult in OMNET++ to have a lot of projects.

Alex
  • 141
  • 1
  • 13

1 Answers1

1

You have to add link to the sqlite3 library in run configuration of CSW project. Go to Run | Run Configurations... | Main tab | More>> and in Dynamic libraries write path to sqlite3 library. Please note that the path has to be relative to the working directory, and without a dll suffix, without a lib prefix.
If the dll file of sqlite3 doesn't contain lib prefix, try to rename it (for example from sqlite3.dll into libsqlite3.dll).

Jerzy D.
  • 6,707
  • 2
  • 16
  • 22
  • If I add my path to the `${opp_shared_libs:/CBCSWSim/simulations/avspeedaggreg/path}` I receive an error, that it is not an existing folder or file. – Alex Sep 22 '15 at 07:40
  • The error is: `argument to ${opp_shared_libs} needs to be an existing file, folder, or project` – Alex Sep 22 '15 at 07:56
  • The path has to contain a filename. For example: if you want to load library `c:\sqlite3\libfoo.dll`, and your working directory is `c:\omnetpp\CBCSWSim\simulations\avspeedaggreg`, then you should just write: `../../../../sqlite3/foo`, without `${opp_shared_libs:....`. – Jerzy D. Sep 22 '15 at 08:01
  • When I try to find the libsqlite3.dll on my pc, I receive an error `Cannot determine location for ../../../../../../../sqlite/sqlite3`, so I just copied it to my working directory and wrote `sqlite3`. It produces no errors. So, as long, as I don't use functions from `CB_CSW_Cloud`, simulation is running, but when I call a constructor of a class from `CB_CSW_Cloud`, I have error `Simulation terminated with exit code: -1073741511`. I don't know if it is still `sqlite3` problem or something else. Is it possible to have some more info about this error in OMNETT++? – Alex Sep 22 '15 at 09:03
  • You can obtain more information about error provided that you compile both projects in debug mode. Then in `omnetpp.ini` set: `debug-on-errors=true` and prepare debug configuration (in the same way as run configuration). Then start debug. The debugger should stop executing of your code when an error occurs. And you should be able to view the lines of code which cause this error. – Jerzy D. Sep 22 '15 at 09:58
  • Thank you, now I see an error in DEBUG mode, if I use a function from `CB_CSW_Cloud`. It's `During startup program exited with code 0xc0000139.` – Alex Sep 22 '15 at 10:53