![](/img/trans.png)
[英]difference between header files “<stdio.h>” and “<stdlib.h>”
[英]Where can i find the definition of functions declared in c standard header files like stdlib.h?
我正在使用Linux(ubuntu)。
我想閱讀一些標頭文件(如stdlib.h
中聲明的函數的函數定義
我嘗試尋找stdlib.c
但找不到一個。
誰能告訴我在系統上哪里可以找到相應的代碼文件。
如果我太天真,請原諒我。 謝謝
您需要下載glibc的源代碼。 您的發行版通常僅附帶C庫的編譯版本。 另請參閱Wikipedia文章 。
(例如,在類似Debian的系統上,嘗試apt-get source libc6
。)
對於類似Linux的系統,glibc並不是唯一的C庫,存在兩個“競爭者”。 例如, uClib是用於嵌入式應用程序的非常小的替代品。
對於大多數基於Linux的系統,標准庫由glibc提供。 您可以在此處瀏覽git存儲庫:
http://sourceware.org/git/?p=glibc.git;a=tree
請注意,許多有趣的資源都藏在sysdeps
樹下,尤其是sysdeps/unix/sysv/linux
等。
如果您在ubuntu中使用,則意味着您使用vim編輯器運行C程序。要在哪個頭文件中使用該頭文件,請在Esc模式下按gf。 例
#include<stdio.h>
you placed in the cursor point s and press the gf then automatically go to the standard library of stdio.h
(or)
使用命令更改目錄
cd /usr/include
該目錄包含在所有頭文件中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.