I have the following code (in main.c) to initialise a typedef
struct that is in a header file (phOsal.h).
main.c
#include <phOsal.h>
...
phOsal_RPi_DataParams_t osal;
...
phOsal.h
/**
* \brief RPi osal parameter stucture
*/
typedef struct
{
uint16_t wId; /**< ID of this component, do not modify */
/* Other stuff */
uint8_t * bLEDPins;
uint8_t bLEDCount;
uint8_t * bDIPSWPins;
uint8_t bDIPSWCount;
uint8_t bCommDev_ResetPin;
} phOsal_RPi_DataParams_t;
when I compile this using the cmake commands cmake ./Source
and make
I get a compile error.
error: unknown type name 'phOsal_RPi_DataParams_t'
If I comment it out the program compiles fine. Also in main.c
there are other DataParams
that are declared and used but do not throw the compiler error.
I have read a number of questions on here and none of them seem to be what is wrong and have tried the following.
- Checked whether the
#ifndef
and#define
are correct - Changed the layout to be
struct dataparams {...};
and then called it inmain.c
usingstruct dataparams osal;
- Changed the include to have "" instead of <>
Any help would be much appreciated.