Syntax error near unexpected token `(' ./test.c: l
Solved
dragons2
Posted messages
182
Status
Member
-
[Dal] Posted messages 6122 Registration date Status Contributor Last intervention -
[Dal] Posted messages 6122 Registration date Status Contributor Last intervention -
Hello everyone!
So, I'm starting to learn the C language, I code under Linux using the command:
gcc (filename).c -Wall -o (filename)
then:
./filename
Everything was going well for 2 weeks, but since yesterday I can't execute a program. I keep getting the same error no matter the code.
./test.c: line 2: syntax error near unexpected token ‘(‘
./test.c: line 2: `int main(void)'
I tried to give the file permissions with: chmod +x filename, but nothing works!
The problem is that I often use my computer for university, I'm a computer science student. I need to be able to code on my computer.
Thank you in advance for the help you will provide me.
So, I'm starting to learn the C language, I code under Linux using the command:
gcc (filename).c -Wall -o (filename)
then:
./filename
Everything was going well for 2 weeks, but since yesterday I can't execute a program. I keep getting the same error no matter the code.
./test.c: line 2: syntax error near unexpected token ‘(‘
./test.c: line 2: `int main(void)'
I tried to give the file permissions with: chmod +x filename, but nothing works!
The problem is that I often use my computer for university, I'm a computer science student. I need to be able to code on my computer.
Thank you in advance for the help you will provide me.
2 answers
I copied a code that works, the compilation and execution go well, but the same code copied to the desktop gives me this message in the console:
If I then use:
chmod +x folder name I get the message:
So it's indeed a permission issue?
bash: ./exo7.c: Permission denied
If I then use:
chmod +x folder name I get the message:
./exo7.c: line 2: syntax error near unexpected token « ( » ./exo7.c: line 2: `int main (void)'
So it's indeed a permission issue?
If your compilation command is:
this command produces an executable named "exo7" from "exo7.c"
Under Linux, you run the executable like this: