문제

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 :)

도움이 되었습니까?

해결책

Use extern.

In your header file, make:

extern unsigned char my_array[];

In exactly one .c file, defined the array.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top