Linux debian中C头文件的位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11132153/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Location of C header files in debian
提问by James Joy
Where does debian stores C header files like stdio.h
, string.h
etc? I am working on a project and I need to add a header file to the location but I couldn't locate it anywhere.
debian 在哪里存储 C 头文件,例如stdio.h
,string.h
等等?我正在处理一个项目,我需要向该位置添加一个头文件,但我无法在任何地方找到它。
采纳答案by Dietrich Epp
The system headers are in /usr/include
and the headers for user-installed packages are in /usr/local/include
.
系统标头在 中/usr/include
,用户安装的包的标头在/usr/local/include
.
But you only should put headers there if you are writing a library which other projects will use. Otherwise, you should use the -I
flag for your compiler to specify the location of additional header file search paths.
但是,只有在编写其他项目将使用的库时,才应该将标题放在那里。否则,您应该使用-I
编译器的标志来指定附加头文件搜索路径的位置。
回答by paulsm4
Typically in /usr/include
It wouldn't hurt to run a command like this to make sure you've got the "basics" like compiler and standard headers:
apt-get install build-essential
Failing all else, you can also do a "find". For example:
find / -name stdio.h -print 2> /dev/null
通常在 /usr/include
运行这样的命令以确保您拥有诸如编译器和标准头文件之类的“基础知识”不会有什么坏处:
apt-get install build-essential
如果其他方法都失败了,您还可以进行“查找”。例如:
find / -name stdio.h -print 2> /dev/null