Results 1 to 8 of 8
Hi,
I'm a newbie to linux and using gcc under that environment.
I have a real simple program in c and am using the gcc compiler and I am having ...
- 10-19-2009 #1Just Joined!
- Join Date
- Oct 2009
- Posts
- 1
Trouble compiling simple hello world program
Hi,
I'm a newbie to linux and using gcc under that environment.
I have a real simple program in c and am using the gcc compiler and I am having trouble compiling the code. The code is thus:
I use the following the compile:Code:#include <stdio.h> int main(void) {printf("Hello world");}
gcc -o program main.c
I get the following error message at the top of the output:
in file included from /usr/include/stdio.h:75
from main.c:2:
/usr/include/libio.h:332: error: expected specifier-qualifier-list before size_t
Can anyone help me resolve this error?
Thanks,
Chris.
- 10-19-2009 #2Linux Newbie
- Join Date
- Nov 2007
- Location
- Planet Earth
- Posts
- 152
There is no error in your program... AFAIK, that was a bug on last year version of gcc in certain distributions (I think debian and related) ... try to upgrade your compiler package in your package manager.
HugoEOF
- 10-20-2009 #3Linux User
- Join Date
- Aug 2006
- Posts
- 458
is this for school or for your own lesson in programming? If its the latter, there's no need to use C/C++. There are other excellent programming languages that can help you with programming..eg Python, Perl etc
- 10-20-2009 #4
I agree with Hugo, Seems like an issue with gcc Install recent version of gcc and try again.
It's true,languages like python is amazing (I'm learning it) ,but I would recommend C.
Learning languages will always great,so try to learn as much as you can.- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 10-20-2009 #5
There is no reason to discourage one from learning a certain language. A programming language is merely a tool and the more tools in your belt the better off you are. The best rule is to use the best tool for the job, and the more tools you have, the more choices for which one to use.
- 10-20-2009 #6Linux User
- Join Date
- Aug 2006
- Posts
- 458
there you said it.. best tool for the job. If OP is programming drivers, doing game programming, or other low level stuff, sure, he can learn C. BUT for normal everyday stuffs, eg parsing files, formatting text, doing OS stuff like coping files, backing up files etc...There is no need to learn C/C++. He doesn't need to learn about pointers etc...
This guy is already struggling with C due to compiler problems...How much time has he wasted?
how much time does he need to learn this ?
That's what choosing a good programming language to learning programming is. less hassle, more productivity.Code:#!/usr/bin/env python print "hello world"
- 10-20-2009 #7
You're making many assumptions. I would not assume the OP has no programming experience and I would not assume what the OP is intending to do. MANY applications and libraries are written in C and C++. Perhaps OP is intending on contributing to one of these applications? We don't know, my only point in the previous post was not to discourage anything. Besides, how do you think python knows how to do what it does? That C back end is there for a reason.
- 10-20-2009 #8Linux User
- Join Date
- Aug 2006
- Posts
- 458
that's why i asked OP whether he is doing homework or not..right?
so? what's important is how one think about solving the problem..not getting nitty gritty into the lower level details.MANY applications and libraries are written in C and C++.
that's why i asked OP right?Perhaps OP is intending on contributing to one of these applications? We don't know, my only
that's why i asked. Now, if his answer is say, file parsing, do you think he need to do up a C program for that?point in the previous post was not to discourage anything.
I don't need to know the backend of Python to know how to program in Python, do i? what's your point?Besides, how do you think python knows how to do what it does? That C back end is there for a reason.


Reply With Quote
