Setup mingw

From PLplotWiki
Revision as of 13:52, 21 December 2008 by Smekal (Talk | contribs) (spell)

Jump to: navigation, search

Setup MinGW command line tools

MinGW[1] a collection of freely available and freely distributable Windows specific header files and import libraries, augmenting the GNU Compiler Collection, (GCC), and its associated tools, (GNU binutils). MinGW provides a complete Open Source programming tool set which is suitable for the development of native Windows programs that do not depend on any 3rd-party C runtime DLLs.

Download and install

  • The easiest way is to download the On demand TDM/MinGW Installer 1.808.3 [2]and run it. This installer allows you to download and install the official MinGW command line tools 3.4.5 and then unofficial TDM's experimental GCC/MinGW32 builds (gcc 4.3.1).
  • Run the installer and press 'Create'. As installation directory I chose c:\MinGW-3.4.5 or c:\MinGW-4.3.1 depending on the gcc version I selected. To install gcc 4.3.1 choose the 'TDM-GCC Recommended, C/C++' type of install for gcc 3.4.5 choose 'MinGW stable, C/C++'. In addtion you can choose a fortran, ada, objc and objc++ language extension. After clicking 'Install' the packages will be downloaded and installed in the given directory.
  • The only thing which is not installed is the make tool. Therefore go to the file release site of MinGW and download mingw32-make-3.81-20080326-3.tar.gz and extract the content with your favorite zip tool in to the MinGW installation directory.

Setup

To configure and compile plplot with MinGW it is best to use the Windows CLI. Please follow the instructions in [setup_cli Setup CLI] to get the Windows Command Line Interface ready for development. Then open your favorite text editor and enter the following CLI commands

@echo off

rem setup MinGW compiler
set MINGWDIR=C:\MinGW-4.3.1
set PATH=%MINGWDIR%\bin;%PATH%

rem add Ada support if you installed the ada package
set CMAKE_LIBRARY_PATH=%MINGWDIR%\lib\gcc\mingw32\4.3.1\adalib;%CMAKE_LIBRARY_PATH%

rem setup PLplot library
set PLPLOTDIR=path_to_plplot
set PLPLOT_LIB=%PLPLOTDIR%\data
set PATH=%PLPLOTDIR%\dll;%PATH%

and save this to e.g. mingwvars.bat. If you installed the MinGW 3.4.5 command line tools, exchange in the script 4.3.1 with 3.4.5 (twice). Start you Windows CLI, cd into the directory where the batch file was saved and run mingwvars.bat. Run gcc --version, gfortran --version and gnat to see if everything works. Your MinGW developing environment is now ready.

Links

  1. MinGW Homepage
  2. TDM's Experimental GCC/MinGW32 Builds