What is the environment variable for GCC/G++ to look for .h files during compilation: LIBRARY_PATH, C_PATH, C_INCLUDE_PATH or CPLUS_PATH?

前端 未结 3 1957
一整个雨季
一整个雨季 2021-01-30 05:44

Is there an environment variable for GCC/G++ to look for .h files during compilation?

I google my question, there are people say LIBRARY_PATH, C_PATH, C_INCLUDE_PATH, CP

3条回答
  •  再見小時候
    2021-01-30 06:06

    Just look at the actual gcc documentation. It's all explained there.

    To summarize:

    • LIBRARY_PATH is for the linker, not for header files (used when looking for libraries requested by a -l option)
    • CPATH specifies directories to look for header files in (like the -I option)
    • C_INCLUDE_PATH and CPLUS_INCLUDE_PATH are like CPATH, but for C/C++ respectively.

提交回复
热议问题