请问一个头文件 定义报错问题
我自己定义了一个 wifi_uart.h 的文件, 文件中很多unsigned char 和布尔 变量要定义。
我调用了 uin8_t 和bool 来定义, 如下:
- #ifndef _wifi_uart_H
- #define _wifi_uart_H
- #include "stm8s.h"
- /************* 本地变量声明 **************/
- uint8_t RX1_Buffer[RX1_Lenth]; //接收缓冲 idata
- uint8_t TX1_Cnt; //发送计数
- uint8_t RX1_Cnt; //接收计数
- bool B_TX1_Busy; //发送忙标志
- #endif
因为uint8_t 是 在stm8s.h 中 定义的。
- /*!< Unsigned integer types */
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned long uint32_t;
- typedef enum {FALSE = 0, TRUE = !FALSE} bool;
所有我在 wifi_uart.h 中 添加了头文件 #include "stm8s.h"
但是编译的的时候出现了 重复定义的错误:
#error clnk Debug\smartsocket.lkf:58 Debug\wifi_uart.o: symbol _RX1_Buffer multiply defined (Debug\main.o)
我把 wifi_uart.h 中 的 #include "stm8s.h" 注释掉:
编译的时候 却 显示了 一大堆 缺少 ”;“ 的 错误, 但实际是没有缺的
#error cpstm8 inc\wifi_uart.h:20(0+7) missing ;
我想 只把 下面句加到 wifi_uart.h 中
编译的时候 也是报了 重复定义的错误!!!!
- /*!< Unsigned integer types */
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned long uint32_t;
- typedef enum {FALSE = 0, TRUE = !FALSE} bool;
请问具体是该如何处理?
|