[英]Do I need to explicitly include a common header file(in an include path folder) used in shared library?
I am using a shared library , say, shr.so
. 我正在使用共享库,例如
shr.so
This has some header file, say, shr_struct.h
with structures I need to use in my program , say, main_prog.c
. 这有一些头文件,比方说,
shr_struct.h
与我需要在我的程序中使用的结构,说, main_prog.c
。
Do I need to keep a copy of shr_struct.h
in my include path so that I can declare objects of structure types in shr_struct.h
in main_prog.c
? 我需要保持一份
shr_struct.h
在我的包含路径,这样我可以在声明结构类型的对象shr_struct.h
在main_prog.c
?
If your main_prog.c
depends on shr_struct.h
, the compiler will need to know where this last file is located. 如果您
main_prog.c
取决于shr_struct.h
,编译器将需要知道这最后文件的位置。
Now if the library is installed in the system "standard" library path, you may not have to explicitly add this path to the compiler command as it may be smart enough to search in the standard system path by itself. 现在,如果该库已安装在系统“标准”库路径中,则您不必将此路径显式添加到编译器命令中,因为它可能足够聪明,可以自行搜索标准系统路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.