I am extremely new to programming and I am having problems with the basic starting program of, 'hello, world'.
I have downloaded MinGW and I believe I set it up correctly with the command promt by entering: setx PATH "%PATH%;C:\MinGW\bin"
Then I created this code following a guide while using Notepad++
#include <stdio.h>
int main(void)
{
puts("Hello, world!");
return 0;
}
saving it under c:/code/c/hello.c
When I try to compile it or run it under: gcc -o hello hello.c
, I get this error
gcc: error: hello.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
And I am not sure how to fix this. I have tried looking around, but I cant find any answers or I just don't understand them.
gcc: error: hello.c: No such file or directory gcc: fatal error: no input files compilation terminated.
Means that gcc
is unable to find your hello.c
source file. You should either cd to the source folder:
c:
cd c:\code\c\
gcc -o hello.exe hello.c
Or use a full path to the source in the command line:
gcc -o c:\code\c\hello.exe c:\code\c\hello.c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With