r/C_Programming • u/Vivid_Employment_950 • Sep 29 '26
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
2
u/Imaginary_Dirt_5359 Sep 29 '26
Put your code here.
7
u/Snezzy_9245 Sep 29 '26
I was driving my car and it did something and now it doesn't. What is wrong? /s
1
u/Vivid_Employment_950 Sep 29 '26
UPDATE :
The c prog file is never compile, if the c program file is not in the same folder as gcc
3
u/Traveling-Techie Sep 29 '26
What’s the error message?
2
u/This_Growth2898 Sep 29 '26
What shell are you using? Provide all the commands you are using to compile your code in the first and the second situation (and the command to switch between)
1
u/CodingFishes Sep 29 '26
If you reference any libraries (include stdio.h), make sure they're available locally to the .c file you're trying to compile.