Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MinGW error: No such file or directory exists [closed]

I'm running MinGW on windows XP SP3. I wrote a simple program in C++ and saved it as a .cpp file. When I tried to compile it in MinGW at the correct directory a message appeared saying " Error: No such file or directory exists" but I know its in the correct directory.

This is what I typed into MinGW

cd C:\MinGW test  # Where I saved the .cpp file
g++ test.cpp -o test.exe

After that an error appears.

Also I did change the Environment Settings path to C:\MinGW\bin

like image 479
lazycody Avatar asked Dec 05 '25 06:12

lazycody


1 Answers

To get it to work, you should run the compiler from the folder where the program is, not where MinGW is. First, you need to set your PATH to include MinGW. You can do this with set PATH = C:\MinGW\bin;%PATH% on the command line.

Then, cd to where the program is located and run g++ test.cpp -o test.exe to compile, and test to run.

Hope this helps!

like image 71
ameed Avatar answered Dec 07 '25 20:12

ameed