无论我在哪里包含某个commands.h
头文件,在除 之外的任何地方commands.c
,编译器都会抛出此错误。commands.h
包含使用 中定义的结构的函数原型instrument.h
,特别是:
void readConfig(PSTATPLUS_CONFIG* pStatConfig_p, MLD_PACKET* rxPacketUart2_p);
void readState(PSTATPLUS_STATE* pStatState_p, MLD_PACKET* rxPacketUart2_p);
void writeConfig(PSTATPLUS_CONFIG* pStatConfig_p, MLD_PACKET* rxPacketUart2_p);
void writeState(PSTATPLUS_STATE* pStatState_p, MLD_PACKET* rxPacketUart2_p);
PSTATPLUS_CONFIG
并PSTATPLUS_STATE
如此定义,在instrument.h
:
typedef struct {
float signalAmplitude; // Signal Amplitude
float signalOffset; // Signal Offset
unsigned char waveType; // Waveform Type
float startFreq; // Frequency Start
float stopFreq; // Frequency Stop
unsigned int numIncrements; // Number of Increments
unsigned char scale; // Linear(0) or log(1)
float stepDelay; // Step Delay
}PSTATPLUS_CONFIG;
typedef struct { // Current biosensor status
unsigned char scan; // Scan status (on/off)
unsigned char sample; // Sample status (on/off)
unsigned int currentIncrement; // Current scan increment
unsigned char gain; // Current gain setting
float iValue; // I voltage
float qValue; // Q voltage
unsigned int sampleDivider; // 1 takes every ADC sample, 2 takes every 2nd ADC sample, 3 takes every 3rd ADC samp... n takes every nth. 0 stops data collection.
unsigned int totalSamples; // total number of samples wanted to complete one measurement.
}PSTATPLUS_STATE;
我需要一些写在commands.h
头文件中的定义才能被我的instrument.c
文件访问,但如前所述,每次我在其中包含commands.h
时,编译器都会产生该错误。我试过commands.h
在我的其他一些源文件中包含,同样的事情一直在发生。任何帮助表示赞赏。
担