0

I am trying to use Crypto++ 8.6.0 for my use in my project, but I cannot use the library. I have tried to use these instructions at first to build Crypto++ with qmake, but it did not work. Then, I decided to use the MinGW option from here but it is outdated and cannot be applied to 8.6.0 I have successfully created a cryptopp-static.lib file using CMake files in this repo, then I moved the file to my project root folder where CMakeLists.txt and added

target_link_libraries(MyApp cryptopp-static.lib)

after add_executable but it returned an error

"C:\Program Files\JetBrains\CLion 2021.2.2\bin\cmake\win\bin\cmake.exe" --build C:\Users\Dev\Desktop\MyApp\cmake-build-release --target MyApp -- -j 6
[ 25%] Linking CXX executable MyApp.exe
C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcryptopp-static
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\MyApp.dir\build.make:124: MyApp.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:82: CMakeFiles/MyApp.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:89: CMakeFiles/MyApp.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:123: MyApp] Error 2

I have also tried just running make on the source directory of Crypto++, because it has a GNUMakefile, and in return I got libcryptopp.a, I moved this file to the root directory of my project and cmake, but it returned the same error as above.

Then I tried to add this to my CMakeLists.txt as said in this question.

add_library(CryptoPP STATIC IMPORTED)
set_target_properties(CryptoPP PROPERTIES IMPORTED_LOCATION /cryptopp-static.lib)
target_link_libraries(MyApp cryptopp-static.lib)

But it still returned the same error.

Is there any easy way I can build, install, and use Crypto++ 8.6.0 in Windows 10 with CLion?

RonaldoCodes
  • 21
  • 1
  • 2
  • did you build cryptopp with mingw? When you got `libcryptopp.a` were you still trying to link to `cryptopp-static.lib` rather than `libcryptopp.a`? – Alan Birtles Oct 18 '21 at 21:04
  • @AlanBirtles i ran `make` in the source directory to get libcryptopp.a. When I got it i replaced cryptopp-static.lib with libcryptopp.a but it returned the same error. – RonaldoCodes Oct 18 '21 at 21:35

0 Answers0