Cygwin setup for C, C++ and Fortran compilation

Дата канвертавання19.04.2016
Памер11.37 Kb.

Cygwin setup for C, C++ and Fortran compilation

(with debugging, editing, make, and some common tools and scripting languages).

Go to Select Install-or-update-now. After selecting run and next a few times, choose a random or nearby download site. Maximize the Select-Packages window when it appears, and in addition to the default packages select the following:

Devel (short for development): binutils, gcc-core, gcc-g++, gcc-g7, gdb and make

Editors: emacs and nano

Math: bc, gnuplot, lapack and octave

Perl: perl and perl_manpages

Python; python

System: util-linux.

(click on + to expand the categories and then on the circles with arrows to select; the version number of the package that will be installed is shown). To add packages later, repeat the procedure, but before choosing packages to install click next to Keep at the top of the Select-Packages window (hoover with the mouse to get help on these top-row options).

By default the Cygwin directory tree resides under c:\Cygwin, and the user’s home directory is /home/username (e.g. /home/jonasson — or c:\Cygwin\home\jonasson). There is a link to the drives of the computer, /cygdrive, so for instance c:\WINDOWS is accessible through /cygdrive/c/WINDOWS.

When the Cygwin icon is selected, Cygwin runs in an MS-DOS window. There are two types of setup that are apropriate, setting the properties of this DOS-window (size, font, colors etc.), and initial settings for the Cygwin bash shell.

Setting the window properties: Right-click in the titlebar and select Properties. The chosen properties will of course depend on personal preference, but one possibility is: Options: QuickEdit Mode on; Font: 14 pt Lucida Console; Layout: buffer 150 by 300 and size 100 by 50; Colors: black screen text, screen back­ground R245 G245 B230. To use quick-edit, paint text with left button, right-click (anywhere in window) to copy and right click again to paste.

Initial bash settings: There are several files that the bash shell reads for initialization. Amongst them are /etc/profile and ~/.bash_profile (read when logging in, which happens when Cygwin is started — ~ is the user’s home directory), and /etc/.bashrc and ~/.bashrc (read when a non-login shell is started e.g. with the command bash). The default .bash_profile executes ~/.bashrc so it is sufficient to edit that. One possibility is the following .bashrc-file:

alias ls="ls --color=auto --show-control-chars"

export LS_COLORS='fi=00;32:di=01;31:ex=01;34:ln=00;35:tw=00;00:ow=01;31'

export MANPAGER='less -isrRX'


PS1='\[\e[0;31m\]\w $ \[\e[0m\]'

The first two lines are for coloring the output from ls: ordinary files green, directories red, executable files blue, links magenta, and temporaries black. The next line sets the path where files to be executed are searched for (. being the current directory) and the last line sets the prompt to show the current directory colored brown (\w being the code for displaying the directory).

There is another initialization file, ~\.inputrc which controls (among other things) the interpretation of 8-bit ASCII characters (such as á, é, ð…). Suitable contents for this, which will allow file names with such characters is:

set completion-ignore-case on

set meta-flag on

set convert-meta off

set output-meta on

The files could for example be created using a Windows editor (e.g. wordpad or Matlab) or a Cygwin editor (e.g. nano). Open c:\Cygwin\home\username\.bashrc, delete the current contents and replace with the 5 lines above (using cut and paste if you are reading this document electronically). Repeat for .inputrc (note that the original default initialization files are stored in /etc/skel).

База данных защищена авторским правом © 2016
звярнуцца да адміністрацыі

    Галоўная старонка