Unknown Type - Unable to access typedef variables from another .h file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unknown Type - Unable to access typedef variables from another .h file

635 Views
sen_ZCS
Contributor I

Hi,


I am developing a firmware for Kinetis-FS32K144 using S32DS IDE. I have a typedef structure in a header file user_data.h and in System_Ctrl.h another structure with typedef variable from user_data.h was created. It is generating error for the type EEPROM_DEF as "Unknown Type".

I tried adding file include path from project settings, still no luck. What could be the issue?

#ifndef __USER_DATA_H__
#define __USER_DATA_H__


/****************************************************************/
/* Includes */
/****************************************************************/

#include "../Common/System_Ctrl.h"

typedef struct
{
uint32_t ui32Data[100];
} EEPROM_DEF;

 

#ifndef __SYSTEM_CTRL_H__
#define __SYSTEM_CTRL_H__


/****************************************************************/
/* Includes */
/****************************************************************/
#include <stdint.h>
#include "../Test/User_data.h"

typedef struct
{
/* Layout ID */
uint8_t ui8VersionMajor;
uint8_t ui8VersionMinor;

/* EEPROM Data */
EEPROM_DEF aSet;

/* Fill up the area */
uint8_t aReserved[I2C_EEPROM_RUNTIME_LENGTH - (I2C_EEPROM_HEADER_LENGTH + 3 + sizeof(EEPROM_DEF) + 4)];

/* CRC32 */
uint32_t ui32CRC;
} I2C_EEPROM_RUNTIME_COMPLETE;

0 Kudos
2 Replies

599 Views
sen_ZCS
Contributor I

Hello Stan,

Thanks for the reply. Removing the System_Ctrl.h from user_data.h didn't work. Finally I moved all the depended structures from System_Ctrl.h to user_data.h and it worked. 

0 Kudos

609 Views
stanish
NXP Employee
NXP Employee

Hello,

I'd suggest you to avoid including a header file to the other one and other one to be included back in the original header.. this leads to circular dependency during .c file preprocessing.

Do you really need #include "../Common/System_Ctrl.h" in "user_data.h"?

I'd suggest you to revise your design.

 

Hope it helps.

Stan