Re: I have syntax error when i execute littles programs (drag and drop) in C on fedora

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 7 Apr 2005, Paul Howarth wrote:

bastidesamuel@xxxxxxx wrote:
I want to write littles programs in c on fedora
I have done vi prog
then chmod 755 prog

then i have drag and drop on "vi" some program of wiki dictionnary to
test that it work #include <stdio.h>
#include "math.h"


int main(void)
		{
  			printf("%d\n",add(3,5));
		}

but 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 .

Paul has described below one way to compile your program and run it.

The reference to "return 0;" means that a correct C program would include that as the last line of main():

int main(void)
{
   printf("%d\n",add(3,5));
   return 0;
}

Leaving it out probably won't prevent your program from running, but it may not correctly indicate its success to the operating system.



Thank you very much for help , sam ...

Try this:

$ mv prog prog.c
$ make prog
$ ./prog

Paul.




-- Matthew Saltzman

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


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux