GCC Fatal Error
Solution 1
Desktop is not located at /Desktop
rather it is located at ~/Desktop
.
Thus execute these commands.
cd ~/Desktop
(for changing directory to Desktop)gcc hello.c -o hello
(for compiling C program)- Then execute your application by
./hello
, if it shows any error change its permissions withchmod +x hello
Solution 2
Then I typed within the terminal:
cd /Desktop
/Desktop
is not the path to your desktop. /Desktop
is the path to a directory "Desktop
" in /
(your root
directory). /home/<username>/Desktop
or, shortened, ~/Desktop
is the path to your desktop.
So first change your terminal's working directory to your desktop's path:
cd ~/Desktop
Then compile the file again:
gcc hello.c -o hello
Related videos on Youtube
guntbert
Updated on September 18, 2022Comments
-
guntbert over 1 year
everyone
Here's my problem; So, I'm new to Ubuntu and programming and I just wanted to start with C. I created the classic "hello.c" file
#include <stdio.h> main () { printf("Hello World!"); }
Then I typed within the terminal:
cd /Desktop
Because the file is located in Desktop
And then I typed
gcc hello.c -o hello
But here come the troubles, it suddenly appeared a problem that says:
gcc: error: hello.c: No such file or directory gcc: fatal error: no input files compilation terminated.
So, how can I fix that?
-
j0h about 9 yearsI seem to recall gcc used to just say "no input files" That seems less confusing.
-
-
Thomas Ward about 9 years
gcc
gives it+x
by default, I thought... at least in 14.04 and later.