MC logo
Windows Command-Line Compiling
[^] Dr. Bennet
------------------------------------------------------------------------------ The default installation of Codeblocks on Windows with the GNU compiler tools does not make the compiler commands available from the Windows command tool. If you have such an installation, here's how to make gcc and g++ work in the Windows command window.
  1. Locate the compiler executable files installed with Codeblocks and open the folder.
    As you can see, mine ended up in C:\Program Files (x86)\CodeBlocks\MinGW\bin. Keep that window open. Make sure you find the MinGW sub-folder since this is where the compiler and other build tool executables are kept.
  2. Open the start menu, and find the Computer menu on the right. Don't open it, but right-click on it, and you will see the submenu shown here. Click on properties.
  3. You will get this system menu, which I've only shown a bit of here. Click on “Advanced system settings”.
  4. This will give you the “System Properties” menu, from which you need to click on “Environment Variables”.
  5. Choose the “Path” variable from the lower box, and select “Edit”
  6. Add the path to the compiler executables at the end of the list, separated from the existing path information with a semicolon.
  7. To get the correct path, return to the window showing the folder of executables. If you click on the folder icon at the left the location stripe, it changes to a proper file path, and is selected. You can then copy it and paste into the Path value in the environment variable window.
  8. Ok out of everything, then when you fire up a command window, the gcc command, and others in that directory (such as make) will work.