我以Ubuntu(Linux)+ gcc为例。谁提供了C头文件?
stdio.h
sys/socket.h
poll.h
pthread.h
其中在Ubuntu Linux(安装GCC),分别由该组织提供的? GNU? Linux? ISO? Ubuntu的?
那么相应的库呢?
我以Ubuntu(Linux)+ gcc为例。谁提供了C头文件?
stdio.h
sys/socket.h
poll.h
pthread.h
其中在Ubuntu Linux(安装GCC),分别由该组织提供的? GNU? Linux? ISO? Ubuntu的?
那么相应的库呢?
这些库头是安装在系统上的C库的一部分。
在Ubuntu上glibc使用实现(GNU C库)。 C库的一些其它例子:
uClibc的(嵌入),AVR-libc中(嵌入),dietlibc,klibc,elibc_FreeBSD ...
ISO/IEC已创建的标准和这些库跟随它。
~ head -n 20 /usr/include/stdio.h
/* Define ISO C stdio on top of C++ iostreams.
Copyright (C) 1991, 1994-2010, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
Ubuntu由Canonical维护,所以他们是组装软件包的人。
作为C标准库的GNU实现的一部分,标准C库标头由GNU.org维护,所以它是Canonical从中取得的源代码。
事实上,头文件(也不是实现)不是gcc bundle的一部分(尽管canonical/ubuntu可能称之为gcc-devel或其他)。 大多数Linux发行版使用包含这些的gnu C库(glibc)。 – AoeAoe 2012-03-23 15:52:29
@AoeAoe,谢谢,修正。 – 2012-03-23 15:55:07
它们由GNU提供。
的/usr/include/stdio.h
第一线:
/* Define ISO C stdio on top of C++ iostreams.
Copyright (C) 1991, 1994-2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library...
GCC是一个GNU编译器系统,无论它是安装在
哪头?哪个库? – 2012-03-23 15:08:35
每个标题通常都有一个版权声明。使用gcc -H来了解使用哪个头文件。 – 2012-03-23 19:30:36