简体   繁体   中英

How to download and use the openssl library from GitHub?

I am writing a C++ program where I need to find the sha512 hash of a file at one point so I'm thinking of using the openssl library from https://github.com/openssl/openssl/tree/master/include/openssl . I have downloaded the whole openssl repository but I guess I only need the include/openssl folder so I deleted the rest. Now I have no idea how to tell my compiler to look for sha.h in the openssl folder. One way I tried is by going to my codeblocks settings>compiler>linker settings and then adding all the files present inside the openssl folder and then writing include <openssl/sha.h> but its not working although I am getting a suggestion as you can see in this image . When I hit build and run I get the error E:\CodeBlocks\C++\test\main.cpp|2|fatal error: openssl/sha.h: No such file or directory| . I am new to using third party libraries and have never done it.

The problem is not with OpenSSL, but with your lack of knowledge how to use CodeBllocks to tell the compiler where your libraries are.

在 Code::Blocks 中添加包含路径

In Code::Blocks 20.3 (Linux) you need to

  1. Select Project from the main menu
  2. Select Project/targets options
  3. In the pop-up dialog select Project build options
  4. Select Search directories tab
  5. Select Compiler tab
  6. Press Add button
  7. Navigate to the directory with the header files of your library; you can select "keep this as a relative path", which is recommended in projects developed on different computers

Remember that you show to the compiler additional (to the default ones) path(s) where it has to look for headers, not individual header files themselves.

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