How to Fix Error: GCC/G++ No Such File Or Directory



If you're seeing the error message "GCC/G++ No such file or directory" on Windows when trying to compile C or C++ code, don't worry, we've got you covered! In this tutorial, we'll show you how to fix this error and get your code compiling again. First, you need to install GCC/G++ on your Windows system. One way to do this is to install the MinGW-w64 GCC/G++ compiler. You can download the installer from the official website and run it to install the compiler. Once you've installed the compiler, make sure that the directory containing the GCC/G++ executable is included in your system's PATH variable. To do this, follow these steps: Right-click on "This PC" and select "Properties".
Click on "Advanced system settings" in the left sidebar.
Click on the "Environment Variables" button.
Under "System Variables", scroll down and find the "Path" variable. Click on "Edit".
Click on "New" and enter the path to the directory containing the GCC/G++ executable (usually C:\MinGW\bin).
Click "OK" to close all the windows.
Finally, if you're using an IDE like Visual Studio Code or Code::Blocks, make sure that the compiler path is set correctly in the settings. In Visual Studio Code, for example, you can go to File – Preferences – Settings and search for "C_Cpp: Intelli Sense Engine". Set the "Compiler path" to the path of your GCC/G++ executable (usually C:\MinGW\bin\g++.exe). By following these steps, you should be able to fix the "GCC/G++ No such file or directory" error on Windows and compile your C or C++ code without any issues.