[英]How to add multiple header include and library directories to the search path in a single gcc command?
How to add multiple header include and library directories to the search path in a single gcc command?如何在单个 gcc 命令中将多个 header 包含和库目录添加到搜索路径?
Use multiple -I flags for the include directories and multiple -L flags for the lib directories对包含目录使用多个 -I 标志,对 lib 目录使用多个 -L 标志
You can set the C_INCLUDE_PATH
environment variable.您可以设置
C_INCLUDE_PATH
环境变量。
export C_INCLUDE_PATH=.:/some/dir:/some/other/dir
as well as the LIBRARY_PATH
environment variable.以及
LIBRARY_PATH
环境变量。
On Linux you need to use -I
before each directory that you want to add.在 Linux 上,您需要在要添加的每个目录之前使用
-I
。
Example:例子:
user:/home/my_project$ gcc -g -Wall -I/usr/include/lib_Directory/ -I./include -c ./src/transcod.c
./
means the current directory where you are running the command, in this case my_project ; ./
表示您正在运行命令的当前目录,在本例中为my_project ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.