Keil compilation error
#include <stdio.h>
#include <stdlib.h>
...
#define Result_TIMOUT 3
#define Result_INTIAL 0
#define Result_ERROR 1
...
typedef enum
{
MD_INIT,
HARDWARE_CHECK,
FILESYSTEM,
BS_SEARCH,
BS_REGISTER,
BS_REG_CHK,
ME_FC_INIT,
ME_SOCKET,
ME_READY
}STATUS_MACHINE_INDEX;
... // struct, enum, union
extern md_Socket_CB SocketOpen_CB;
extern md_Socket_CB SocketClose_CB;
...
Solution:
Use conditional compilation to prevent header files from being included repeatedly. Take the above code as an example
#ifndef __MODEM_H__
#define __MODEM_H__
#include <stdio.h>
#include <stdlib.h>
...
#define Result_TIMOUT 3
#define Result_INTIAL 0
#define Result_ERROR 1
...
typedef enum
{
MD_INIT,
HARDWARE_CHECK,
FILESYSTEM,
BS_SEARCH,
BS_REGISTER,
BS_REG_CHK,
ME_FC_INIT,
ME_SOCKET,
ME_READY
}STATUS_MACHINE_INDEX;
... // struct, enum, union
extern md_Socket_CB SocketOpen_CB;
extern md_Socket_CB SocketClose_CB;
...
#endif
Keil compiled successfully
Read More:
- error: field ‘XXX’ declared as a function [How to Solve]
- C Language error: two or more data types in declaration specifiers
- Json: struct field readyReplicas has json tag but is not exported [How to Solve]
- [Solved] C++ error: undefined reference to `xxx‘
- [Solved] Compilation error: dereferencing pointer to incomplete type…
- [Solved] KEIL Error: keil Error: failed to execute ‘C:\Keil\ARM\ARMCC‘
- [Solved] MIT cheetah make error: ‘ioctl’ was not declared in this scope
- [Solved] VINS-MONO: integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’
- [Solved] Error: Flash Download failed – “Cortex-M3“
- How to Solve Keil Error: error: #29: expected an expression
- How to Solve UW Microcontroller KEIL _WEAK Error
- [Solved] No corresponding flash error is found during MDK download
- error RC2247 : SYMBOL name too long [How to Solve]
- [Solved] keil2 Error: FATAL ERROR L210: I/O ERROR ON INPUT FILE
- [Solved] iperf Analyze Error: unable to create a new stream: Invalid argument
- Solve error LNK2001 about pcl::io::vtkPolyDataToPointCloud
- How to Solve Pycharm SQL Union Error
- [Solved] KEIL Compile Error: Error: L6220E: Load region LR_IROM1 size (65552 bytes) exceeds limit (65536 bytes)……
- Keil Error: error:#130:expected a “{” [How to Solve]
- How to Solve Hdsc32 MDK compile error: #29 & #223-D