Do I need to explicitly include a common header file(in an include path folder) used in shared library?

半腔热情 提交于 2019-12-11 21:07:17

问题


I am using a shared library , say, shr.so. This has some header file, say, shr_struct.h with structures I need to use in my program , say, 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?


回答1:


If your main_prog.c depends on shr_struct.h, the compiler will need to know where this last file is located.

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.



来源:https://stackoverflow.com/questions/17043228/do-i-need-to-explicitly-include-a-common-header-filein-an-include-path-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!