|
|
(105 intermediate revisions by 9 users not shown) |
Line 1: |
Line 1: |
| [[Category:User Documentation]] | | [[Category:User Documentation]] |
− | ==Using the MinGW installer==
| |
− | Note: At the present time, it is still preferrable to download the packages by hand, as the installers are not production quality (unless you really feel unsure unpacking a couple of archives).
| |
| | | |
− | Also, the installer reportedly does not work on Windows Vista, follow the [[MinGW_installation#GCC_3.4.5_manual_install | manual installation instructions]].<br />
| + | == Overview == |
− | (In general, MinGW is not confirmed to work for any Windows Vista betas or RCs)
| |
| | | |
− | MinGW Installer 5.02 allows to choose the SF mirror while 5.03 does not (automatically picks one randomly). | + | A compiler toolchain is what Code::Blocks uses to turn the code you type into it into numbers that the computer understands. As a compiler toolchain is a very complex undertaking it is not part of Code::Blocks itself but rather is a separate project that Code::Blocks then uses. The kind of compiler toolchains talked about on this page are "MinGW" toolchains. Which means "Minimalist GNU for Windows." And "GNU" expands to "GNU's Not Unix." More information about the GNU project can be found on the [https://www.gnu.org/home.en.html GNU Home Page]. |
| | | |
− | MinGW Installer 5.0.x are broken because of changes done by sf.net; please use the MinGW Installer 5.1.x | + | For most MinGW-based compiler toolchains, having your toolchain in your PATH is important because it means that during development the toolchain libraries will be accessible by default to your programs as you develop them and also makes it easier to use utilities such as [https://cmake.org/ CMake] as they will be able to find your compiler toolchain. When you actually distribute your programs to other computers then you will copy the needed .dll files out of your toolchain directory and include them as part of your installer. On your machine they are in your PATH so you always have them, on your users computers they won't have the compiler toolchain so there you provide the .dll files with your program. |
| | | |
− | Installers allows to downloads/installs "previous", "current" and "candidate" mingw packages.
| + | == TDM-GCC == |
| | | |
− | *[http://prdownloads.sourceforge.net/mingw/MinGW-5.0.2.exe MinGW Installer 5.0.2]
| + | [https://jmeubank.github.io/tdm-gcc/ TDM-GCC] is the toolchain that will be used as the example for this guide. TDM-GCC statically links the required toolchain libraries into your final executable. Which means that when you create your installer for your final program there are less files to include - they are built into your executable itself. The Code::Blocks team recommends TDM-GCC. |
− | *[http://prdownloads.sourceforge.net/mingw/MinGW-5.0.3.exe MinGW Installer 5.0.3]
| |
− | *[http://prdownloads.sourceforge.net/mingw/MinGW-5.1.3.exe MinGW Installer 5.1.3]
| |
| | | |
− | '''Note that the MinGW version number is not related to the actual compiler version.'''
| + | === Installation === |
| | | |
− | Please do note that the installer applications require an internet connection and will download the actual MinGW packages at the time of installation.
| + | Download the on-demand installer and run it. |
| | | |
− | The required MinGW Components are "MinGW Base Tools", "g++ compiler" and "MinGW make".
| + | Go through the installation pages, the red arrows are all the default options which we will be keeping and the last blue arrow is to indicate that you will be putting TDM-GCC into your system's PATH. |
| | | |
− | ==GCC 3.4.5 manual install==
| + | [[Image:TDM_Create.png]] [[Image:TDM_Arch.png]] |
− | This is the "candidate" release of MinGW, so it is not considered "stable" officially.<br />Personally, I have not had any kind of problem with this release.
| |
| | | |
− | To do a manual install, simply download the desired files and extract them all into the same directory. If you have WinZip, PowerArchiver, or any other similar program, this is as easy as selecting all the archives simultaneously and choosing "unpack here" from the context menu.
| + | [[Image:TDM_Inst_Dir.png]] [[Image:TDM_Inst_Options.png]] |
| | | |
− | For clarity, I recommend to put MinGW into C:\MinGW, but almost any other locations should do equally well. Avoid pathnames with spaces or exotic characters, as this may confuse some commandline tools (most notably <tt>gdb</tt>).
| + | Once you are ready, click Install to proceed. |
− | ===Base system with C++===
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-core-3.4.5-20060117-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-core-3.4.5-20060117-1.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-g++-3.4.5-20060117-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-g++-3.4.5-20060117-1.tar.gz?download]
| |
− | *[http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz?download http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz?download http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/w32api-3.6.tar.gz?download http://prdownloads.sourceforge.net/mingw/w32api-3.6.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/binutils-2.17.50-20060824-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/binutils-2.17.50-20060824-1.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/mingw32-make-3.81-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/mingw32-make-3.81-1.tar.gz?download]
| |
| | | |
− | ===Optionally:=== | + | === Code::Blocks Configuration === |
− | ====Fortran77 compiler====
| |
− | *[http://prdownloads.sf.net/mingw/gcc-g77-3.4.5-20060117-1.tar.gz?download http://prdownloads.sf.net/mingw/gcc-g77-3.4.5-20060117-1.tar.gz?download]
| |
− | ====gdb debugger====
| |
− | *[http://prdownloads.sf.net/mingw/gdb-6.3-2.exe?download http://prdownloads.sf.net/mingw/gdb-6.3-2.exe?download]
| |
− | ====Other developer tools====
| |
− | =====UnxUtils=====
| |
− | Ports of the most often used Unix utilities. Note that some tools in UnxUtils are quite a bit outdated, so make sure you <u>do not</u> overwrite already existing MinGW files with their UnxUtils counterparts.
| |
− | *[http://unxutils.sourceforge.net/UnxUtils.zip UnxUtils]
| |
− | *[http://unxutils.sourceforge.net/UnxUpdates.zip UnxUtils-Latest-Updates]
| |
| | | |
− | =====GnuWin32=====
| + | Go to your Compiler settings: |
− | ''More recent'' versions of commonly used Unix utilities. Also: utilities not found in UnxUtils at all.
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/coreutils-5.3.0-bin.zip?download coreutils-5.3.0]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/zip-2.3-3-bin.zip zip-2.3.3]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/tar-1.13-1-bin.zip?download tar-1.13-1]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/gzip-1.3.5-3-bin.zip?download gzip-1.3.5]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/bzip2-1.0.3-1-bin.zip?download bzip2-1.0.0-1]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/autoconf-2.59-bin.zip?download autoconf-2.59]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/automake-1.9.4-bin.zip?download automake-1.9.4]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/bison-2.1-bin.zip?download bison-2.1 (includes m4)]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/flex-2.5.4a-1-bin.zip?download flex-2.5.4a]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/gperf-3.0.1-bin.zip?download gperf-3.0.1]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/diffutils-2.8.7-1-bin.zip?download diffutils-2.8.7]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/patch-2.5.9-6-bin.zip?download patch-2.5.9-6]
| |
− | Note: The version 2.5.9 of patch from GnuWin32 seems to have a problem with unified diffs
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/grep-2.5.1a-bin.zip?download grep-2.5.1]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/sed-4.1.4-bin.zip?download sed-4.1.4]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/hextools-1.0-bin.zip?download hextools-1.0]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/findutils-4.2.20-2-bin.zip?download findutils-4.2.20]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/less-394-bin.zip?download less 3.94]
| |
− | *[http://prdownloads.sourceforge.net/mingw/wget-1.9.1-mingwPORT.tar.bz2?download wget-1.9.1]
| |
− | *[http://www.gimp.org/~tml/gimp/win32/gettext-0.14.5.zip gettext-0.14.5]
| |
− | *[http://www.gimp.org/~tml/gimp/win32/gettext-dev-0.14.5.zip gettext-dev-0.14.5]
| |
| | | |
− | Dependencies:
| + | [[Image:Compiler_Settings.png]] |
− | *[http://prdownloads.sourceforge.net/gnuwin32/pcre-6.4-1-bin.zip?download pcre-6.4.1 (needed by grep and less)]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/libintl-0.14.4-bin.zip?download libintl-0.14.4 (needed by most tools)]
| |
− | *[http://prdownloads.sourceforge.net/gnuwin32/libiconv-1.9.2-1-bin.zip?download libiconv-1.9.2-1 (needed by most tools)]
| |
| | | |
− | ==Resulting Folder Layout==
| + | And then under the "Toolchain executables" tab (red arrow), click on the ellipsis ("...", blue arrow) and choose the root directory where you installed TDM-GCC 32-bit. Once you have that directory chosen, in the "Program Files" sub-tab (green arrow) area fill out the fields as shown. If you aren't using the TDM-GCC toolchain there might be minor variation in the executable names. If you choose the blue arrow ellipsis ''first'' then for each ellipsis you click on under "Program Files" you will already be in your TDM-GCC <tt>bin</tt> directory where the actual programs are. |
− | [[Image:Lay.png]]
| |
| | | |
| + | [[Image:CB_TDM_Toolchain.png]] |
| | | |
− | ==GCC 3.4.4 manual install==
| + | Now, go to your Debugger settings: |
− | Some people have reported various problems with gcc version 3.4.4, so it may be worth a consideration to use the either the 3.4.5 or 3.4.2 releases until a build from the 4.x branch is available.<br />Personally, I have not had any kind of problem with either 3.4.4 or 3.4.5.
| |
− | ===Base system with C++===
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-core-3.4.4-20050522-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-core-3.4.4-20050522-1.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-g++-3.4.4-20050522-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-g++-3.4.4-20050522-1.tar.gz?download]
| |
− | *[http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz?download http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz?download http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz?download]
| |
− | *[http://prdownloads.sf.net/mingw/w32api-3.5.tar.gz?download http://prdownloads.sf.net/mingw/w32api-3.5.tar.gz?download]
| |
− | *[http://prdownloads.sf.net/mingw/binutils-2.17.50-20060824-1.tar.gz?download http://prdownloads.sf.net/mingw/binutils-2.17.50-20060824-1.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/mingw32-make-3.80.0-3.tar.gz?download http://prdownloads.sourceforge.net/mingw/mingw32-make-3.80.0-3.tar.gz?download]
| |
| | | |
− | ===Optionally:===
| + | [[Image:Settings_Debugger.png]] |
− | ====gdb debugger====
| |
− | *[http://prdownloads.sf.net/mingw/gdb-6.3-2.exe?download http://prdownloads.sf.net/mingw/gdb-6.3-2.exe?download]
| |
− | ====Objective-C====
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-objc-3.4.4-20050522-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-objc-3.4.4-20050522-1.tar.gz?download]
| |
− | ====Native Java (experimental)====
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-java-3.4.4-20050522-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-java-3.4.4-20050522-1.tar.gz?download]
| |
− | ====Fortran-77====
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-g77-3.4.4-20050522-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-g77-3.4.4-20050522-1.tar.gz?download]
| |
− | ====Ada====
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-ada-3.4.4-20050522-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-ada-3.4.4-20050522-1.tar.gz?download]
| |
| | | |
| + | Choose your default debugger (red arrow), and then fill in the Executable path for it as shown for TDM-GCC 32-bit (blue arrow). |
| | | |
− | ==GCC 3.4.2 manual install==
| + | [[Image:Debugger_Default.png]] |
− | Installing MinGW can be quite intimidating the first time because it is not obvious what you have to do. Luckily, it is actually pretty simple.<br />
| |
− | To do a manual install, simply download the required files and extract them all into the same directory. For simplicity, I recommend <tt>C:\MinGW</tt>.
| |
− | ===Base system with C++===
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-core-3.4.2-20040916-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-core-3.4.2-20040916-1.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-g++-3.4.2-20040916-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-g++-3.4.2-20040916-1.tar.gz?download]
| |
− | *[http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz?download http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz?download http://prdownloads.sourceforge.net/mingw/mingw-utils-0.3.tar.gz?download]
| |
− | *[http://prdownloads.sf.net/mingw/w32api-3.5.tar.gz?download http://prdownloads.sf.net/mingw/w32api-3.5.tar.gz?download]
| |
− | *[http://prdownloads.sf.net/mingw/binutils-2.16.91-20050827-1.tar.gz?download http://prdownloads.sf.net/mingw/binutils-2.16.91-20050827-1.tar.gz?download]
| |
− | *[http://prdownloads.sourceforge.net/mingw/mingw32-make-3.80.0-3.tar.gz?download http://prdownloads.sourceforge.net/mingw/mingw32-make-3.80.0-3.tar.gz?download]
| |
− | ===Optionally:===
| |
− | ====gdb debugger====
| |
− | *[http://prdownloads.sf.net/mingw/gdb-6.3-2.exe?download http://prdownloads.sf.net/mingw/gdb-6.3-2.exe?download]
| |
− | ====Objective-C====
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-objc-3.4.2-20040916-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-objc-3.4.2-20040916-1.tar.gz?download]
| |
− | ====Native Java (experimental)====
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-java-3.4.2-20040916-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-java-3.4.2-20040916-1.tar.gz?download]
| |
− | ====Fortran77 compiler====
| |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-g77-3.4.2-20040916-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-g77-3.4.2-20040916-1.tar.gz?download]
| |
| | | |
− | ====Ada==== | + | === Summary === |
− | *[http://prdownloads.sourceforge.net/mingw/gcc-ada-3.4.2-20040916-1.tar.gz?download http://prdownloads.sourceforge.net/mingw/gcc-ada-3.4.2-20040916-1.tar.gz?download]
| + | |
| + | You now have a Code::Blocks environment that is configured to use TDM-GCC 32-bit properly. Using this guide as a template you can easily set up alternative compiler toolchains no matter the source - just follow the same basic procedure. |
| + | |
| + | == Alternative MinGW Compiler Toolchains == |
| + | |
| + | [https://osdn.net/projects/mingw/ MinGW] - The original project. |
| + | |
| + | [https://sourceforge.net/projects/mingw-w64/files/ MinGW-Builds] ➡ In, "Toolchains targeting Win32 or Win64," ➡ "Personal Builds," ➡ "mingw-builds," ➡ Version, ➡ Threading Model, ➡ Exception Model, ➡ Revision. |
| + | |
| + | [http://mingw-w64.org/doku.php Mingw-w64] - The parent project of MinGW-Builds, includes much more than is necessary - MinGW-Builds will usually suffice instead of the full works. |
| + | |
| + | [http://www.equation.com/servlet/equation.cmd?fa=fortran MinGW Equation] - A package that also provides OpenMP. |
| + | |
| + | ==Development Tools== |
| + | |
| + | Normally you should not need many of these tools. ZIP is convenient, especially when: [[Installing_Code::Blocks_from_source_on_Windows | building Code::Blocks itself]], but other than that these tools only serve specialized purposes. |
| + | |
| + | ===UnxUtils=== |
| + | |
| + | * [https://sourceforge.net/projects/unxutils/ UnxUtils] |
| + | |
| + | ===GnuWin32=== |
| + | |
| + | *[https://sourceforge.net/projects/gnuwin32/ GnuWin32] |
| + | |
| + | ===ZIP=== |
| + | *[ftp://ftp.info-zip.org/pub/infozip/win32/zip300xn.zip zip-3.0.0 32-bit] or [ftp://ftp.info-zip.org/pub/infozip/win32/zip300xn-x64.zip zip-3.0.0 64-bit] |
Overview
A compiler toolchain is what Code::Blocks uses to turn the code you type into it into numbers that the computer understands. As a compiler toolchain is a very complex undertaking it is not part of Code::Blocks itself but rather is a separate project that Code::Blocks then uses. The kind of compiler toolchains talked about on this page are "MinGW" toolchains. Which means "Minimalist GNU for Windows." And "GNU" expands to "GNU's Not Unix." More information about the GNU project can be found on the GNU Home Page.
For most MinGW-based compiler toolchains, having your toolchain in your PATH is important because it means that during development the toolchain libraries will be accessible by default to your programs as you develop them and also makes it easier to use utilities such as CMake as they will be able to find your compiler toolchain. When you actually distribute your programs to other computers then you will copy the needed .dll files out of your toolchain directory and include them as part of your installer. On your machine they are in your PATH so you always have them, on your users computers they won't have the compiler toolchain so there you provide the .dll files with your program.
TDM-GCC
TDM-GCC is the toolchain that will be used as the example for this guide. TDM-GCC statically links the required toolchain libraries into your final executable. Which means that when you create your installer for your final program there are less files to include - they are built into your executable itself. The Code::Blocks team recommends TDM-GCC.
Installation
Download the on-demand installer and run it.
Go through the installation pages, the red arrows are all the default options which we will be keeping and the last blue arrow is to indicate that you will be putting TDM-GCC into your system's PATH.
Once you are ready, click Install to proceed.
Code::Blocks Configuration
Go to your Compiler settings:
And then under the "Toolchain executables" tab (red arrow), click on the ellipsis ("...", blue arrow) and choose the root directory where you installed TDM-GCC 32-bit. Once you have that directory chosen, in the "Program Files" sub-tab (green arrow) area fill out the fields as shown. If you aren't using the TDM-GCC toolchain there might be minor variation in the executable names. If you choose the blue arrow ellipsis first then for each ellipsis you click on under "Program Files" you will already be in your TDM-GCC bin directory where the actual programs are.
Now, go to your Debugger settings:
Choose your default debugger (red arrow), and then fill in the Executable path for it as shown for TDM-GCC 32-bit (blue arrow).
Summary
You now have a Code::Blocks environment that is configured to use TDM-GCC 32-bit properly. Using this guide as a template you can easily set up alternative compiler toolchains no matter the source - just follow the same basic procedure.
Alternative MinGW Compiler Toolchains
MinGW - The original project.
MinGW-Builds ➡ In, "Toolchains targeting Win32 or Win64," ➡ "Personal Builds," ➡ "mingw-builds," ➡ Version, ➡ Threading Model, ➡ Exception Model, ➡ Revision.
Mingw-w64 - The parent project of MinGW-Builds, includes much more than is necessary - MinGW-Builds will usually suffice instead of the full works.
MinGW Equation - A package that also provides OpenMP.
Development Tools
Normally you should not need many of these tools. ZIP is convenient, especially when: building Code::Blocks itself, but other than that these tools only serve specialized purposes.
UnxUtils
GnuWin32
ZIP