Chinaunix

标题: 关于头文件的问题 [打印本页]

作者: lxcsyh    时间: 2006-09-12 10:25
标题: 关于头文件的问题
在windows下开发, 一般只要包含少数头文件,如#include <windows.h>就可以了。
而在linux下要包含很多头文件, 是不是可以自己定义一个类似于windows.h的头文件,
把系统头文件都包含进去,可是不知道该把哪些写进去比较好。
一般的标准c库肯定要写的,其他例如<unistd.h> <pwd.h> <sys/types.h>当然也应该
包含进去, 不过实在是有点多, 不知道该包含哪些了。
作者: l.darkfire    时间: 2006-09-12 12:36
#ifndef  _COMMON_H
#define _COMMON_H

/* C常用标准头文件 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <signal.h>
#include <errno.h>



/*  C++常用标准头文件 */
#include <iostream>
#include <fstream>
#include <string>

using  namespace std;



/* 系统常用头文件 */
#include <unistd.h>            
#include <fcntl.h>            
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/time.h>



/* socket常用头文件 */
#include <sys/socket.h>
#include <arpa/inet.h>        
#include <netinet/in.h>      
#include <netdb.h>            

#endif




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2