You are not logged in.
I'm currently taking a course in C programming, and I have a question about the error messages returned by GCC.
When ever i try to compile a program containing syntax errors, i get cryptic and not very helpfull error messages.
If i try to compile:
#include <stdio.h>
int main(void)
{
int i;
i = 0
return 0;
}
I get following from GCC:
error.c: In function â:
error.c:8:2: error: expected â before â
But shouldn't the message be something like:
error.c: In function 'main':
error.c:8:2: error: expected ; before 'return'
or am I mistaken?
/AcId
Last edited by AcId (2010-10-13 17:48:19)
Offline
Woah. That is very strange. I've never seen that before.
I assume you're using Arch Linux. What text editor did you use to write the code? Which terminal application are you using?
...those questions are probably unrelated to the problem, but we might as well get them out of the way.
Offline
adee ~ $ gcc s.c
s.c: In function 'main':
s.c:8:9: error: expected ';' before 'return'
Yes the ; is missing! The ; character is changed in your compile output, don't know why
And the Main is also changed...... strange
Last edited by adee (2010-10-13 16:50:53)
Offline
Ofc I'm using Arch
I use GNU Emacs for all my coding, and xterm as terminal application.
Also, my current locale settings are en_DK.UTF8, anyone know if that might pose a problem?
Offline
It seems the problem is only when running GCC in xterm inside X, if I run it in console, it prints errormessages just fine.
/AcId
Offline
I located the error. Apparently Xlib doesn't support locale en_DK.UTF8, so changed it to en_US.UTF8
Thanks for the help guys
Offline