Informative error messages
21.08.2005 12:27
The following piece of code has one simple syntax error on the first line:
287 for(x=0;x<XMAX/2+!;x++) {
288 for(y=0;y<YMAX/2+1;y++) {
289 for(z=ZMAX/2;z<ZMAX+1;z++) {
290 space[x][y][z]=0;
291 }
292 }
293 }
When you try to compile it with GCC 4.0, you get this torrent of very informative error messages that point you to all other lines in the source file except the one that has the error. GCC obviously wants to make sure that the line with the error is the very last line of code that you will check.
lines.c:291: warning: control reaches end of non-void function lines.c: At top level: lines.c:324: warning: type defaults to ‘int’ in declaration of ‘id’ lines.c:324: error: initializer element is not constant lines.c:324: warning: data definition has no type or storage class lines.c:329: error: syntax error before ‘for’ lines.c:338: warning: type defaults to ‘int’ in declaration of ‘black’ lines.c:338: error: initializer element is not constant lines.c:338: warning: data definition has no type or storage class lines.c:340: error: syntax error before numeric constant lines.c:340: warning: type defaults to ‘int’ in declaration of ‘g2_set_line_widt h’ lines.c:340: error: conflicting types for ‘g2_set_line_width’ /usr/include/g2.h:121: error: previous declaration of ‘g2_set_line_width’ was he re lines.c:340: warning: data definition has no type or storage class lines.c:342: warning: type defaults to ‘int’ in declaration of ‘s_draw’ lines.c:342: warning: parameter names (without types) in function declaration lines.c:342: error: conflicting types for ‘s_draw’ lines.c:206: error: previous definition of ‘s_draw’ was here lines.c:342: warning: data definition has no type or storage class lines.c:344: warning: type defaults to ‘int’ in declaration of ‘g2_close’ lines.c:344: warning: parameter names (without types) in function declaration lines.c:344: error: conflicting types for ‘g2_close’ /usr/include/g2.h:107: error: previous declaration of ‘g2_close’ was here lines.c:344: warning: data definition has no type or storage class lines.c:345: error: syntax error before string constant lines.c:345: warning: type defaults to ‘int’ in declaration of ‘printf’ lines.c:345: error: conflicting types for ‘printf’ lines.c:345: note: a parameter list with an ellipsis can’t match an empty parame ter name list declaration lines.c:345: warning: data definition has no type or storage class
Posted by Tomaž
| Categories: Code
Comments
Add a new comment
