c - Beginner: syntax error before int main () -


i'm trying run hello world program getting error

./ex1.c: line 3: syntax error near unexpected token `(` ./ex1.c: line 3: `int main (int argc, char *argv[])' 

or

./ex1.c: 3: ./ex1.c: syntax error: "(" unexpected 

or

./ex1.c:3: unknown file attribute: ./ex1.c:4: parse error near `}' 

the weird thing i've run same program before , had no issues.

not sure if these issues related problem happened after installed valgrind run exercise 4 in learn c hard way. received error said permission denied fixed using chmod +x. .c files needed permission had not before. did chmod -r 0777 directory of .c practice files. permission problem fixed error above started. may completed unrelated wanted include in case.

you can't run .c file using ./ex1.c; have compile runnable program first.

assuming have linux/os x machine, use gcc -wall ex1.c -o ex1 compile (or, more simply, make ex1). can ./ex1 run program.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -