標籤:
POSIX標準定義的標頭檔
<dirent.h> 目錄項
<fcntl.h> 檔案控制
<fnmatch.h> 檔案名稱匹配類型
<glob.h> 路徑名模式比對類型
<grp.h> 組檔案
<netdb.h> 網路資料庫操作
<pwd.h> 口令檔案
<regex.h> Regex
<tar.h> TAR歸檔值
<termios.h> 終端I/O
<unistd.h> 符號常量,檔案是Linux的系統調用,好比Windows中的windows.h
<utime.h> 檔案時間
<wordexp.h> 字元擴充類型
-------------------------
<arpa/inet.h> INTERNET定義
<net/if.h> 通訊端本地介面
<netinet/in.h> INTERNET地址族
<netinet/tcp.h> 傳輸控制通訊協定定義
-------------------------
<sys/mman.h> 記憶體管理聲明
<sys/select.h> Select函數
<sys/socket.h> 通訊端借口
<sys/stat.h> 檔案狀態
<sys/times.h> 進程時間
<sys/types.h> 基本系統資料類型(如pid_t,size_t等)
<sys/un.h> UNIX域通訊端定義
<sys/utsname.h> 系統名
<sys/wait.h> 進程式控制制
------------------------------
POSIX定義的XSI擴充標頭檔
<cpio.h> cpio歸檔值
<dlfcn.h> 動態連結
<fmtmsg.h> 訊息顯示結構
<ftw.h> 檔案樹漫遊
<iconv.h> 代碼集轉換使用程式
<langinfo.h> 語言資訊常量
<libgen.h> 模式比對函數定義
<monetary.h> 貨幣類型
<ndbm.h> 資料庫操作
<nl_types.h> 訊息類別
<poll.h> 輪詢函數
<search.h> 搜尋表
<strings.h> 字串操作
<syslog.h> 系統出錯日誌記錄
<ucontext.h> 使用者上下文
<ulimit.h> 使用者限制
<utmpx.h> 使用者帳戶資料庫
-----------------------------
<sys/ipc.h> IPC(具名管道)
<sys/msg.h> 訊息佇列
<sys/resource.h>資源操作
<sys/sem.h> 訊號量
<sys/shm.h> 共用儲存
<sys/statvfs.h> 檔案系統資訊
<sys/time.h> 時間類型
<sys/timeb.h> 附加的日期和時間定義
<sys/uio.h> 向量I/O操作
------------------------------
POSIX定義的可選標頭檔
<aio.h> 非同步I/O
<mqueue.h> 訊息佇列
<pthread.h> 線程
<sched.h> 執行調度
<semaphore.h> 訊號量
<spawn.h> 即時spawn介面
<stropts.h> XSI STREAMS介面
<trace.h> 事件跟蹤
C/C++標頭檔一覽
C
#include <assert.h> //設定插入點
#include <ctype.h> //字元處理
#include <errno.h> //定義錯誤碼
#include <float.h> //浮點數處理
#include <iso646.h> //對應各種運算子的宏
#include <limits.h> //定義各種資料類型最值的常量
#include <locale.h> //定義本地化C函數
#include <math.h> //定義數學函數
#include <setjmp.h> //異常處理支援
#include <signal.h> //訊號機制支援
#include <stdarg.h> //不定參數列表支援
#include <stddef.h> //常用常量
#include <stdio.h> //定義輸入/輸出函數
#include <stdlib.h> //定義雜項函數及記憶體配置函數
#include <string.h> //字串處理
#include <time.h> //定義關於時間的函數
#include <wchar.h> //寬字元處理及輸入/輸出
#include <wctype.h> //寬字元分類
傳統C++
#include <fstream.h> //改用<fstream>
#include <iomanip.h> //改用<iomainip>
#include <iostream.h> //改用<iostream>
#include <strstrea.h> //該類不再支援,改用<sstream>中的stringstream
標準C++
#include <algorithm> //STL 通用演算法
#include <bitset> //STL 位集容器
#include <cctype> //字元處理
#include <cerrno> //定義錯誤碼
#include <cfloat> //浮點數處理
#include <ciso646> //對應各種運算子的宏
#include <climits> //定義各種資料類型最值的常量
#include <clocale> //定義本地化函數
#include <cmath> //定義數學函數
#include <complex> //複數類
#include <csignal> //訊號機制支援
#include <csetjmp> //異常處理支援
#include <cstdarg> //不定參數列表支援
#include <cstddef> //常用常量
#include <cstdio> //定義輸入/輸出函數
#include <cstdlib> //定義雜項函數及記憶體配置函數
#include <cstring> //字串處理
#include <ctime> //定義關於時間的函數
#include <cwchar> //寬字元處理及輸入/輸出
#include <cwctype> //寬字元分類
#include <deque> //STL 雙端隊列容器
#include <exception> //異常處理類
#include <fstream> //檔案輸入/輸出
#include <al> //STL 定義運算函數(代替運算子)
#include <limits> //定義各種資料類型最值常量
#include <list> //STL 線性列表容器
#include <locale> //本地化特定資訊
#include <map> //STL 映射容器
#include <memory> //STL通過分配器進行的記憶體配置
#include <new> //動態記憶體分配
#include <numeric> //STL常用的數字操作
#include <iomanip> //參數化輸入/輸出
#include <ios> //基本輸入/輸出支援
#include <iosfwd> //輸入/輸出系統使用的前置聲明
#include <iostream> //資料流輸入/輸出
#include <istream> //基本輸入資料流
#include <iterator> //STL迭代器
#include <ostream> //基本輸出資料流
#include <queue> //STL 隊列容器
#include <set> //STL 集合容器
#include <sstream> //基於字串的流
#include <stack> //STL 堆棧容器
#include <stdexcept> //標準異常類
#include <streambuf> //底層輸入/輸出支援
#include <string> //字串類
#include <typeinfo> //運行期間類型資訊
#include <utility> //STL 通用模板類
#include <valarray> //對包含值的數組的操作
#include <vector> //STL 動態數組容器
————————————————————————————————
C99增加的部分
#include <complex.h> //複數處理
#include <fenv.h> //浮點環境
#include <inttypes.h> //整數格式轉換
#include <stdbool.h> //布爾環境
#include <stdint.h> //整型環境
#include <tgmath.h> //通用類型數學宏
————————————————————————————————
socket編程時常要用到:
sys/types.h:資料類型定義
sys/socket.h:提供socket函數及資料結構
netinet/in.h:定義資料結構sockaddr_in
arpa/inet.h:提供IP地址轉換函式
netdb.h:提供設定及擷取網域名稱的函數
sys/ioctl.h:提供對I/O控制的函數
sys/poll.h:提供socket等待測試機制的函數
其他在網路程式中常見的標頭檔
unistd.h:提供通用的檔案、目錄、程式及進程操作的函數
errno.h:提供錯誤號碼errno的定義,用於錯誤處理
fcntl.h:提供對檔案控制的函數
time.h:提供有關時間的函數
crypt.h:提供使用DES密碼編譯演算法的加密函數
pwd.h:提供對/etc/passwd檔案訪問的函數
shadow.h:提供對/etc/shadow檔案訪問的函數
pthread.h:提供多線程操作的函數
signal.h:提供對訊號操作的函數
sys/wait.h、sys/ipc.h、sys/shm.h:提供進程等待、進程間通訊(IPC)及共用記憶體的函數
想知道一個函數需要包含哪些標頭檔,需要串連哪些庫,可以用man看一下
man function_name
比如
man 2 socket
告訴你需要包含:
#include <sys/types.h>
#include <sys/socket.h>
man sin:
#include <math.h>
Link with -lm.
有幾種方法可以定位一個檔案
locate xxxx
whereis xxxx
find /usr/include -name "xxxx "
不過你的那個檔案有可能不是標準的系統帶的標頭檔,可能是書中自己寫的標頭檔
引用自:http://blog.chinaunix.net/uid-24219701-id-67552.html
linux常用標頭檔詳解