I am currently porting some code written in 'c' to my arduino environment. It defines a structure which I want to use as a const residing in progmem:
The h-file:
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
typedef struct{
const uint8_t attribs;
// ... and some other variables here
} EmxFont_t;
#ifdef __cplusplus
}
#endif
In a c-file, I instantiate such a structure:
const PROGMEM EmxFont_t FontVerdana11 = {
// Size: Header(12/0x000C)+Index(264/0x0108)+Maps(393/0x0189)=669/0x029D
.attribs = 0x80,
// ... and some other values here
This compiles fine.
If I want to use this 'FontVerdana11' constant in an *ino file:
extern const EmxFont_t FontVerdana11 PROGMEM;
...
lcdBufPuts("Hello, world!", &FontVerdana11, 0, 10, COL_BLACK);
But the compiler complains:
.../EMXArdu.ino:13:24: warning: type of 'FontVerdana11' does not match original declaration
extern const EmxFont_t FontVerdana11 PROGMEM;
^
/tmp/arduino_build_356363/sketch/FontVerdana11.c:43:25: note: previously declared here
const EmxFont_t FontVerdana11 PROGMEM= {
^
It is "only" a warning, but I would like to understand what's wrong here?