在Windows的CLION中使用OpenSSL

时间:2019-05-08 19:09:29

标签: openssl cygwin clion

我正在尝试在CLion中使用OpenSSL库,但由于无法识别该库,因此出现了问题。我正在使用Cygwin作为工具链。这些是一些数据:

Windows版本:10 CLION版本:2019.1.2

工具链配置: -Cygwin版本:3.0.7 -CMake:3.14.2 -调试器:8.1.1

这是我的CMakeLists.txt文件:

cmake_minimum_required(VERSION 3.14)
project(Test)
set(CMAKE_CXX_STANDARD 14)

# Add main.cpp file of project root directory as source file
set(SOURCE_FILES main.cpp)

# Add executable target with source files listed in SOURCE_FILES variable
add_executable(Test ${SOURCE_FILES})

include_directories(usr/local/ssl/include)
include_directories(usr/local/ssl/lib)

link_libraries(ssl)
link_libraries(crypto)

我使用路径“ usr / local / ssl / ...”的原因是openssl在其中放置lib并包含文件。

错误:

====================[ Build | Test | Debug-Cygwin ]=============================
C:\Users\Blumon\.CLion2019.1\system\cygwin_cmake\bin\cmake.exe --build /cygdrive/c/Users/Blumon/Documents/CLionProjects/Test/cmake-build-debug-cygwin --target Test -- -j 4
[ 50%] Building CXX object CMakeFiles/Test.dir/main.cpp.o
/cygdrive/c/Users/Blumon/Documents/CLionProjects/Test/main.cpp:16:10: fatal error: openssl/aes.h: No such file or directory
 #include <openssl/aes.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [CMakeFiles/Test.dir/build.make:63: CMakeFiles/Test.dir/main.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/Test.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/Test.dir/rule] Error 2
make: *** [Makefile:118: Test] Error 2

0 个答案:

没有答案