achimdoebler / UGUI

µGUI - Open Source GUI module for embedded systems
Other
1.2k stars 415 forks source link

ugui.c compiling errors? #26

Closed epikao closed 6 years ago

epikao commented 7 years ago

Hello

I am desperate about follow errors:

I try to setup and compile ugui.c on the raspberry pi 3. when I compile I always get errors like this: //////compiling ///////////// gcc -Wall -pthread -o ugui ugui.c -lpigpio -lrt //////ERROR ////////////// ugui.c: In function ‘_UG_PutChar’: ugui.c:5343:65: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses] color = (((fc & 0xFF) b + (bc & 0xFF) (256 – b)) >> 8) & 0xFF |//Blue component ^ ugui.c:5345:73: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses] (((fc & 0xFF0000) b + (bc & 0xFF0000) (256 – b)) >> 8) & 0xFF0000; //Red component ^ ugui.c:5392:75: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses] color = (((fc & 0xFF) b + (bc & 0xFF) (256 – b)) >> 8) & 0xFF |//Blue component ^ ugui.c:5394:83: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses] (((fc & 0xFF0000) b + (bc & 0xFF0000) (256 – b)) >> 8) & 0xFF0000; //Red component ^ ugui.c: At top level: ugui.c:8483:10: error: conflicting types for ‘gui’ UG_GUI gui; ^ ugui.c:79:16: note: previous declaration of ‘gui’ was here static UG_GUI* gui;

////////////////////////////////////////////////////////////// //programm-code ///////////////////////////////////////////////////////////// My main and pset function in the ugui.c file (at the end):

void ST7775R_pset(UG_S16 x ,UG_S16 y,UG_COLOR c) { ..... .... } UG_GUI gui; int main(void) { ..... ..... initST7775R();

UG_Init(&gui, ST7775R_pset, 176, 220); //UG_SelectGUI(&gui); UG_Update();

while(1)
{   
color(248,0); //red
sleep(1);
color(7,224); //green
sleep(1);
color(0,31); //blue
sleep(1);
color(248,31); //violet
sleep(1);
color(121,239); //grau
sleep(1);
UG_FontSelect(&FONT_24X40);
UG_SetBackcolor(C_BLACK);
UG_SetForecolor(C_CYAN);
UG_PutString(0,0,"Hello World!");
UG_Update();
sleep(3);   
color(251,43); //rosa
sleep(1);
}

spiClose(h); gpioTerminate();
return 0; }

whats wrong???

epikao commented 7 years ago

solution: UG_GUI gui; must be in the main function and not outside