I have syntax error when i execute littles programs (drag and drop) in C on Fedora...

Matthew Saltzman mjs at ces.clemson.edu
Thu Apr 7 13:17:30 UTC 2005


On Thu, 7 Apr 2005, bastidesamuel at neuf.fr wrote:

> When I do ./prog
>> it return to me
>> ./popo: line 4: syntax error near unexpected token `('
>> ./popo: line 4: `int main(void)'
>>
>>
>> I tried to search with google the problem it tell me that i must put
> "return 0 ;"
>> at the end but .. I have the same error i dont understand .
>>
>> Thank you very much for help , sam ...
>
>>
>> Try this
>
> $ mv prog prog.c
> $ make prog
> $ ./prog
> Paul.
>
> Thank you Paul,
> so i have changed the name  prog.c unstead of prog
> but "make prog.c" result "nothing to do ",maybe my little program is not
> makeable

Notice that Paul's suggestion was "make prog" not "make prog.c".

> I don't know I have tried a lot of " how to begin in C"programs but
> these errors are blocking me.
> Thank you for a reply sam ...

Most beginning C books don't talk much about using a particular set of 
tools (editors, compilers, etc.).  What you need is a "beginning C 
porgramming on Unix or Linux" guide.

A beginning C book *should* tell you that the steps are:

(1) Create your source file.
(2) Translate your source file to an executable.
(3) Run the executable.

Different systems have different ways to do these tasks.  Paul's suggested 
steps are one way to do them in Linux.  First you used an editor to create 
prog.c.  Then "make prog" does the translation from source (prog.c) to 
executable (prog).  Then "./prog" runs the executable.

-- 
 		Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs




More information about the fedora-list mailing list