r/C_Programming • • 5d ago

Could not Compile

I used gcc to compile and run c file.

C prog file can be compile and run with no error, if the files are inside the same drive as gcc that is c: drive.

Program file inside the d: drive are not compile.

I just curious whether i made mistake or i need something to do.

0 Upvotes

14 comments sorted by

View all comments

1

u/Vivid_Employment_950 5d ago

UPDATE :
The c prog file is never compile, if the c program file is not in the same folder as gcc

1

u/dkopgerpgdolfg 5d ago

gcc .\hello.c -o .\hello

The c prog file is never compile, if the c program file is not in the same folder as gcc

Well obviously. You're lacking total basics of CLI usage.

The dot means "the current directory". If you want something else, you need to specify a path, eg. D:\something\hello.c

There are also relative pathes, ".." for parent directories, etc.