Compiler gcc:error; no such file or directory

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.

Leave a Comment