I'm new to Linux and C and when trying to run a basic "Hello World" script, i kept getting the same two errors. I have confirmed that everything in the program is correct. errors gotten when trying to compile code
Asked
Active
Viewed 117 times
-5
-
3"I have confirmed that everything in the program is correct." How? – melpomene Sep 09 '17 at 17:40
-
4Please, do not link images of output text. Copy and paste the error messages in your question. – rodrigo Sep 09 '17 at 17:42
2 Answers
0
You are running the gcc
command from the home directory (~
) when the hello.c
file is in ~/Documents
.
Either navigate to Documents
using cd
before running gcc
or place hello.c
in the home directory.

J...S
- 5,079
- 1
- 20
- 35
-
Now that i am in the proper folder, I still receive the error: hello.c:1:19: fatal error: stdio.h: No such file or directory – Benjamin Macedo Sep 09 '17 at 17:58
-
@Benjamin It seems that there is a problem with the way gcc is configured or something https://stackoverflow.com/questions/5898199/fatal-error-stdio-h-not-found – J...S Sep 09 '17 at 18:02
-
Do i have to download a compiler? Or should it already be pre-loaded for linux? And thank you for the help so far! – Benjamin Macedo Sep 09 '17 at 18:05
-
@BenjaminMacedo Which OS are you using? Ubuntu or an Ubuntu derivative? If so try https://askubuntu.com/questions/653324/remove-gcc-from-ubuntu – J...S Sep 09 '17 at 18:06
-
-
-
0
Go to the folder at which your file is existing, and then save the program.
foldername>~$ gcc filename.c

Vivek Singh
- 114
- 1
- 8