With this project, it become trivial to get a native C/C++ compiler on Windows:
- Download the latest release of plain-toolchain-x86-64 archive
- Extract the archive in your workspace
- Done: you have a decent C/C++ compiler on Windows!
This project is a very minimal addon to the amazing projects GNU
GCC and winlibs. The whole point is
to have a portable way to install GNU GCC without modification of any Windows
environment variable (i.e. %PATH%
). By doing that, the source code of the
C/C++ project can be easily re-built verbatim on multiple computers.
Once the toolchain is downloaded and extracted, one can compile the hello-world project. The example should compile and run out-of-the-box and the process should be painless.
While the workspace directory name and location can be anywhere on the disk, the directory structure is very important and cannot be changed:
workspace
├───plain-toolchain-x86-64
├───hello-world
├───project-1
├───project-2
├───project-n
The GDB debugger is included in the winlibs package. To use it, simply start a
shell with toolchain-shell-64.bat
. This command will start a shell with the
toolchain in the local %PATH%
. From there, you can start GDB as
usual. Obviously, in order to let GDB find the source code, the binary file need
to contain the debugging information. Note that we are referring to the
command-line version of GDB, not to any graphical user interface.
Advanced users may need to set environment variables locally. To do that, simply
edit the file cmd-USER-ENVIRONMENT.bat
. If one is using the fantastic Fossil
SCM from Richard HIPP, he could specify the USER
variable in this file.
set USER=Pascal
A lot of develppers use the free editor Notepad++, it's pretty easy to integrate with plain-toolchain-x86-64. It requires the plugin 'NppExec' to be installed.
Add the custom highlight mask, so that if an error is displayed in the 'NppExec' console, it become highlighted and clickable.
%FILE%:%LINE%
One can double-click to jump to the error location.
Type M-x compile
and then write down the full command line.
M-x compile
C:\Users\Pascal\Desktop\workspace\hello-world\make-helloworld-gui.bat
When the user clicks on the error line, GNU Emacs will move to buffer to the
error line. Press g
in the `compilation buffer to recompile the project.
One could setup plain-emacs-commands which make it very convenient to switch between compilation projects.
GCC is released under the GNU General Public License.
Winlibs information can be found on their website.
The very few additional files are released under BSD 2-Clause "Simplified" License:
- cmd-env-64.bat
- cmd-env-64-shell.bat
- cmd-env-common.bat
- cmd-USER-ENVIRONMENT.bat