Windows Command-Line Compiling
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.
- 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.
- 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.
- You will get this system menu, which I've only shown a bit
of here. Click on “Advanced system settings”.
- This will give you the “System Properties” menu, from
which you need to click on “Environment Variables”.
- Choose the “Path” variable from the lower box, and
- Add the path to the compiler executables at the end of
the list, separated from the existing path information with a semicolon.
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.
- Ok out of everything, then when you fire up a command window,
the gcc command, and others in that directory (such as make)