Pregunta

I have a header file, wich contain a unsigned char array that is in fact a ttf font file. In a .c file i'm able to load the font, and to use it ( i include the ttf header file in the .c file), but the problem is that when i'm trying to use this in another c file, i get one of those 2 errors;

First error that i can get say that my array is undeclared.

So i include the header file that contain my array, and i get the second error; Multiple definition of ...

Can someone help ? I dont understand. I hope i'm clear in my explaination, and sorry for my approximative english :)

¿Fue útil?

Solución

Use extern.

In your header file, make:

extern unsigned char my_array[];

In exactly one .c file, defined the array.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top