简体   繁体   中英

How to add cryptopp to project in OMNeT++

First, I built the cryptlib (of cryptopp) in Visual Studio Code 2022. And tried a sample c++ program (using files from the library) and it worked fine.
Then, I included the library cryptlib.lib in my OMNeT++ project.
I also included the cryptopp folder for the.cpp and.h files of the library.
But when I build the o.net++ project, I get this error:

03:05:22 **** Incremental Build of configuration debug for project crypto_final ****
make MODE=debug all
cd src && /usr/bin/make
make 1 : Entering directory '/d/o.netpp-5.7/samples/crypto_final/src' Server.cc
Creating executable: ../out/clang-debug/src/crypto_final_dbg.exe
lld-link: error: could not open 'liblibcpmt.a': No such file or directory
lld-link: error: could not open 'libLIBCMT.a': No such file or directory
lld-link: error: could not open 'libOLDNAMES.a': No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:99: ../out/clang-debug/src/crypto_final_dbg.exe] Error 1
make[1]: Leaving directory '/d/o.netpp-5.7/samples/crypto_final/src' make: *** [Makefile:2: all] Error 2
"make MODE=debug all" terminated with exit code 2. Build might be incomplete.
03:05:25 Build Failed. 2 errors, 0 warnings. (took 3s.352ms)

I don't even know what are these libraries or how to get them built. Can anyone help, please?

Edit #1: btw, when I change the Target type from "Executable" to "Static library (.lib or.a) in makemake options, the project builds normally but does not run properly (has some bugs and no effects can appear on the simulation)

OMNeT++ project uses Makefile, therefore to add an external library or class one should modify makefrag. You should go to Project | Properties | OMNeT++ | Makemake | select root or src of your project | Options , then Custom | Makefrag and write the following lines:

EXTRA_OBJS += -L/d/foo/lib -llibcpmt -lLIBCMT -lOLDNAMES
CFLAGS += -I/d/foo/include

where /d/foo/lib is an example of the directory which contains your cryptlib static files (eg liblibcpmt.a , libLIBCMT.a , ... ), and /d/foo/include - the directory that contains header files of cryptlib .

O.net++ useses MinGW as the runtime system and the C++ compiler's ABI is incompatible with the MS ABI (ie C++ code generated by Visual Studio C++ compiler is incompatible with the code generted by gcc or clang ).

You MUST compile your crypto library also with the clang compiler coming with OMNeT++. Visual Studio compiler will NOT work.

Or... OpenSSL libraries and headers are already available in the Windows distro, so you can pt to use that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM