Tuesday 21 October 2008

Use PSPad with MinGW

In order to compile code writen in PSPad directly in PSPad using the MinGW compiler on Windows XP, follow these steps:
1. Download PSPad from http://www.pspad.com/en/ (I recommend that you download the official release from http://www.pspad.com/en/download.php and then to install the latest beta version, from the forum).
2. Install PSPad.
3. Download MinGW. Use the installer from http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite
4. Install MinGW.
5. Note down the location where you installed MinGW (e.g. C:\MinGW).
6. Add the bin folder from MinGW to Windows Path. To do this right click on My Computer, select Properties, select Advanced, click on Environment Variables; in the System Variables find Path, double click on it and then, in the Variable value section add the path to the bin folder (e.g. C:\MinGW\bin). It must be separated from other entries by ";". Click OK 3 times.
7. In PSPad, click Settings, select Highlighters Settings, then click on Compiler and add the following text for each setting:

Compiler: path to gcc.exe, that can be found in bin, in MinGW (e.g. C:\MinGW\bin\gcc.exe).
Parameters: "%File%" -o "%Dir%%Name%.exe" (with quotes)
Default Directory: the directory where MinGW is insalled (e.g. C:\MinGW).
Run After Compilation: "%DIR%%NAME%.exe"
(with quotes)
Select only: Capture Program Output Window
LOG Praser: %F:%L:

8. Add some code and try to compile (Ctrl+F9). It should work.