Unipisa / Simu5G

Simu5G - 5G NR and LTE/LTE-A user-plane simulation model for OMNeT++ & INET
https://simu5g.org
Other
146 stars 83 forks source link

Include additional API REST library #93

Open juansebastiani2cat opened 1 year ago

juansebastiani2cat commented 1 year ago

Hello,

I've been struggling with the inclusion of an additional library for handling Get requests from the MEC simulation. I need the MEC orchestrator to communicate with an API RESTful server and so I have found the CPR C++ library to do it in C++. I have successfully included the library into the MecOrchestrator.cc as follows:

#include <cpr/cpr.h>

And the project compiles and runs successfully. However, when I actually include a line using the library,

cpr::Response r = cpr::Get(cpr::Url{"http://www.httpbin.org/get"});

the following error arises:

<!> Error: Cannot load library '../../../../src//libsimu5g.so': ../../../../src//libsimu5g.so: undefined symbol: _ZN3cpr7SessionC1Ev

It seems as if it couldn't find the Simu5G library. I already included the additional library into the Makemake Options in the part of Link (additional libraries to link with -l option)

Could you give me please some insights about how to include additional libraries or how to include an API Rest handler please ? Thanks a lot for your help

giovanninardini commented 1 year ago

Hello,

sorry for the delay.

You need to tell OMNeT where to find both the header and the library files. Try with the following procedure:

1) Open "Project Properties" 2)

3)

4)

Then re-build everything and try to re-run your simulation.

Best regards. Giovanni

giovanninardini commented 1 year ago

Hello,

sorry for the delay.

You need to tell OMNeT where to find both the header and the library files. Try with this procedure:

1) Open "Project" -> "Project Properties"

2)

3)

4)

Then try to re-build everything and run your simulation.

Best regards. Giovanni

juansebastiani2cat commented 1 year ago

Hello,

Thanks for your answer. But as soon as I modify the options in the "Project Properties ->Makemake" and change it from "Custom Makefile" to Makemake (So I can include the cpr as you suggested) the following error appears:

/Simu5G/Makefile seems to be a hand-written makefile, refusing to overwrite it. Please delete it or move it away.