How to compile .c file with OpenSSL includes?

前端 未结 7 928
醉梦人生
醉梦人生 2020-11-27 03:40

I am trying to compile a small .c file that has the following includes:

#include 
#include 
#include 

        
7条回答
  •  忘掉有多难
    2020-11-27 04:06

    For this gcc error, you should reference to to the gcc document about Search Path.

    In short:

    1) If you use angle brackets(<>) with #include, gcc will search header file firstly from system path such as /usr/local/include and /usr/include, etc.

    2) The path specified by -Ldir command-line option, will be searched before the default directories.

    3)If you use quotation("") with #include as #include "file", the directory containing the current file will be searched firstly.

    so, the answer to your question is as following:

    1) If you want to use header files in your source code folder, replace <> with "" in #include directive.

    2) if you want to use -I command line option, add it to your compile command line.(if set CFLAGS in environment variables, It will not referenced automatically)

    3) About package configuration(openssl.pc), I do not think it will be referenced without explicitly declared in build configuration.

提交回复
热议问题