头文件包含问题?
#ifndef COMMON_H_
#define COMMON_H_
#include "mmi.h"
#include "../driver/phy.h"
#include <termio.h>
#endif
#ifndef _SHOW_FRAME_H_
#define _SHOW_FRAME_H_
#include "mmi.h"
#endif
COMMON_H_ 与 _SHOW_FRAME_H_ 头文件都未定义过,这样定义可行吗?为什么呢?
[解决办法]
#ifndef _MMI_H_
#define _MMI_H_
...
#endif
的意思是
#ifndef _MMI_H_ == 如果没有定义_MMI_H_
#define _MMI_H_ == 那么,定义_MMI_H_
... == 其他内容
#endif == 结束ifndef条件
那么,如果定义了_MMI_H_,在#ifndef判断时为假,就不会执行条件内部的部分,直接结束#endif。