不好意思,10分也想请教问题, 还希望大家多加理解.
我的系统使red hat 9
我按照书上写的写了一个err_exit.h的头文件,如下:
#include <stdio.h>
#include <errno.h>
#define err_exit(MESSAGE)(
perror(MESSAGE),
exit(1)
)
请问我应该怎么搞才会使我的这个头文件在以后自己写的程序中通过#include "err_exit.h"语句被包进来.
gcc的参数
-I指定include的路径
把err_exit.h放到gcc的include路径下
或者跟你的.c文件放到同一个目录
err_exit.h最好这样写:
#if !defined (__ERR_EXIT_H)
#define __ERR_EXIT_H
#include <stdio.h>
#include <errno.h>
#define err_exit(MESSAGE) (perror(MESSAGE);exit(1))
#endif
然后将这个文件放到usr/include目录下或者放到调用程序的当前目录下