LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   label at the end of compuound statement error (https://www.linuxquestions.org/questions/linux-software-2/label-at-the-end-of-compuound-statement-error-581266/)

isuck@linux 08-31-2007 12:48 PM

label at the end of compuound statement error
 
I'm trying to compile jogutils in my sony vaio but I'm getting an error "label at the end of compound statement" I tried deleting the "defaul:" statement from the .c files but when i do that it gets even worse. Can someone please help me to compile this utils? how do i get rid of that error? thx

colucix 08-31-2007 12:59 PM

Can you post the relevant piece of code? Usually you don't have to simply remove a statement, but replace an obsolete goto [LABEL] statement with a return statement and then remove the LABEL.

isuck@linux 08-31-2007 01:20 PM

This is the output from make:

Quote:

roedor:/home/fabian/jogutils# make
cd jogapp; make
make[1]: Entering directory `/home/fabian/jogutils/jogapp'
gcc -g -O2 `gtk-config --cflags` -c jogapp.c
jogapp.c: In function ‘draw_picture’:
jogapp.c:184: error: label at end of compound statement
jogapp.c:223: error: label at end of compound statement
jogapp.c: In function ‘read_rc’:
jogapp.c:272: warning: incompatible implicit declaration of built-in function ‘exit’
jogapp.c: In function ‘check_jog’:
jogapp.c:319: warning: incompatible implicit declaration of built-in function ‘exit’
jogapp.c:367: error: label at end of compound statement
jogapp.c: In function ‘main’:
jogapp.c:463: warning: incompatible implicit declaration of built-in function ‘exit’
jogapp.c:476: warning: incompatible implicit declaration of built-in function ‘exit’
make[1]: *** [jogapp.o] Error 1
make[1]: Leaving directory `/home/fabian/jogutils/jogapp'
make: *** [jogapp/jogapp] Error 2

And this are lines 89 and 224 with the fn that causes the error, lines 184 and 223 ar
e in red:

Quote:

Quote:

void draw_picture(GdkDrawable *gd)
{
GdkPixmap *pixmap;
GdkPixmap *pixmap2;
GdkFont *font;
char str[100];

gdk_draw_rectangle( gd, drawing_area->style->black_gc,
TRUE, 0, 0, PICT_WIDTH, PICT_HEIGHT);

font = gdk_font_load( fontname );
set_color( 0x0000, 0x0000, 0xffff);

switch( mode ){
case NORM: /* normal mode */
set_color( 0x0000, 0x0000, 0xffff);
switch( delta ){
case 2: /* rotate down 1st step */
gdk_draw_string(gd, font, g_gc, -5, 15-5,
app_title[ring_num(app_num_buff-1)] );
gdk_draw_string(gd, font, g_gc, 10, 30-5,
app_title[app_num_buff] );
gdk_draw_string(gd, font, g_gc, 5, 45-5,
app_title[ring_num(app_num_buff+1)] );
gdk_draw_string(gd, font, g_gc, -10, 60-5,
app_title[ring_num(app_num_buff+2)] );
pixmap = gdk_pixmap_create_from_xpm(drawing_area->window, NULL, NULL,
"./img2.xpm");
delta = 1;
break;
case 1: /* rotate down 2nd step */
gdk_draw_string(gd, font, g_gc, -10, 15-10,
app_title[ring_num(app_num_buff-1)] );
gdk_draw_string(gd, font, g_gc, 5, 30-10,
app_title[app_num_buff] );
gdk_draw_string(gd, font, g_gc, 10, 45-10,
app_title[ring_num(app_num_buff+1)] );
gdk_draw_string(gd, font, g_gc, -5, 60-10,
app_title[ring_num(app_num_buff+2)] );
pixmap = gdk_pixmap_create_from_xpm(drawing_area->window, NULL, NULL,
"./img2.xpm");
delta = 100;
break;
case 100: /* no rotation but needs to be updated */
delta = 0; /* continue */
case 0: /* no rotation, no need to be updated */
gdk_draw_string(gd, font, g_gc, 0, 15,
app_title[ring_num(app_num-1)] );
set_color( 0x0000, 0xdfff, 0xdfff);
gdk_draw_string(gd, font, g_gc, 15, 30,
app_title[app_num] );
set_color( 0x0000, 0x0000, 0xffff);
gdk_draw_string(gd, font, g_gc, 0, 45,
app_title[ring_num(app_num+1)] );

pixmap = gdk_pixmap_create_from_xpm(drawing_area->window, NULL, NULL,
"./img1.xpm");
pixmap2 = gdk_pixmap_create_from_xpm(drawing_area->window, NULL, NULL,
"./img4.xpm");
if (pixmap2) {
gint w, h;
gdk_window_get_size(pixmap2, &w, &h);
gdk_draw_pixmap(gd, g_gc, pixmap2, 0, 0, PICT_WIDTH-35, 20, w, h);
gdk_pixmap_unref(pixmap2);
}

app_num_buff = app_num;
break;
case -2: /* rotate up 1st step */
gdk_draw_string(gd, font, g_gc, -10, 15-10,
app_title[ring_num(app_num-1)] );
gdk_draw_string(gd, font, g_gc, 5, 30-10,
app_title[app_num] );
gdk_draw_string(gd, font, g_gc, 10, 45-10,
app_title[ring_num(app_num+1)] );
gdk_draw_string(gd, font, g_gc, -5, 60-10,
app_title[ring_num(app_num+2)] );
pixmap = gdk_pixmap_create_from_xpm(drawing_area->window, NULL, NULL,
"./img3.xpm");
delta = -1;
break;
case -1: /* rotate up 2nd step */
gdk_draw_string(gd, font, g_gc, -5, 15-5,
app_title[ring_num(app_num-1)] );
gdk_draw_string(gd, font, g_gc, 10, 30-5,
app_title[app_num] );
gdk_draw_string(gd, font, g_gc, 5, 45-5,
app_title[ring_num(app_num+1)] );
gdk_draw_string(gd, font, g_gc, -10, 60-5,
app_title[ring_num(app_num+2)] );
pixmap = gdk_pixmap_create_from_xpm(drawing_area->window, NULL, NULL,
"./img3.xpm");
delta = 100;
break;
default:
}
if (pixmap) {
gint w, h;
gdk_window_get_size(pixmap, &w, &h);
gdk_draw_pixmap(gd, g_gc, pixmap, 0, 0, PICT_WIDTH-25, 0, w, h);
gdk_pixmap_unref(pixmap);
}
break;
case VOL: /* volume mode */
delta = 0;
set_color( 0x0000, 0xdfff, 0x0000);
gdk_draw_string(gd, font, g_gc, 0, 15,
"SET VOLUME" );
set_color( 0x0000, 0x0000, 0xffff);
gdk_draw_string(gd, font, g_gc, 15, 30,
"RETURN" );
// sprintf( str, "[%02d]", vol );
//gdk_draw_string(gd, font, g_gc, 0, 45,
// str );
set_color( 0xc000, 0xc000, 0xc000);
gdk_draw_rectangle( gd, g_gc,
TRUE, 0, 35, PICT_WIDTH-25, 14);
set_color( 0x0000, 0x0000, 0x0000);
gdk_draw_rectangle( gd, g_gc,
TRUE, 1, 36, PICT_WIDTH-27, 12);
set_color( 0x0000, 0xffff, 0x0000);
gdk_draw_rectangle( gd, g_gc,
TRUE, 1, 36, vol*(PICT_WIDTH-28)/MAX_VOL, 12);
pixmap2 = gdk_pixmap_create_from_xpm(drawing_area->window, NULL, NULL,
"./img4.xpm");
if (pixmap2) {
gint w, h;
gdk_window_get_size(pixmap2, &w, &h);
gdk_draw_pixmap(gd, g_gc, pixmap2, 0, 0, PICT_WIDTH-35, 20, w, h);
gdk_pixmap_unref(pixmap2);
}

break;
default:
}
}


isuck@linux 08-31-2007 02:49 PM

this problem was fixed adding ; before the } or deleting the default statement, either one solve it. thanks


All times are GMT -5. The time now is 01:42 PM.