跳到主要内容

Detailed installation process of Cygwin (64 bits)

License

The license terms are provided here: https://cygwin.com/licensing.html

Download the installer

Download the installer

Install cygwin

  • Launch it, it will open the following window
Install cygwin
  • Click on “Next”
  • Click on “Next”
  • Chose a folder where Cygwin will be installed (example: “C:\cygwin” or “C:\cygwin64”)
  • Chose a folder to store the installation files ( example: “C:\User\MyName\Downloads”)
  • Click on “Next”
  • Select a mirror site. Any can be used.
  • Click on “Next”
  • The following window will be displayed
Cygwin select packages
  • Click on “View” combo box and select “Category”
Cygwin select category
  • Then select the specified version in packages
    • Devel/gcc-core (11.2)
    • Devel/gcc-g++ (11.2),
    • Devel/gdb,
    • Devel/make (4.4),
    • Libs/libboost-devel (1.66)
    • Interpreters/python37 (3.7)
    • Interpreters/python37-devel (3.7)
警告

Please be careful to install the same package numbers above, to avoid any misunderstanding.

Optionally, you can install an additionnal toolchain using MinGW_x64. This toolchain enables to build executable files which can run on windows platform using native libraries and, in certain cases, give more stable behavior at runtime.

The following packages have to be installed:

  • mingw64-x86_64-gcc-core (11.2)
  • mingw64-x86_64-gcc-g++ (11.2)
  • mingw64-x86_64-boost (1.66)

To install a package, click on the small arrow and select the binary file to download. We advise to install the last stable version of each package.

install a package
  • Click on “Next”
Confirmation
  • The installer will uninstall old versions if you’re updating your cygwin installation and install missing modules. Click on “Next”
Installation in progress
  • When the installation is done, click on “Finish”
Installation finish

提示

To find out if cygwin has been installed correctly: In the Cygwin folder at the root of C, double-click on Cygwin.bat and type: cygcheck -c.
A (fairly long) list of packages will be edited. Check that the installation of each package is "OK". If it's marked "Incomplete", go back to Cygwin (by clicking on the .exe) and reinstall the faulty packages.

Add cygwin in PATH

This enables to use it in Eclipse for example.

variables environnement systeme
  • Click on “Change Environment Variables”
Change Environment Variables
  • Click on “environment variables”
Path
  • Select the variable named “Path” and click on “change”
信息

You have to select "Path" in the System Variables

  • Click on “New” and add the path to the folder bin in the cygwin folder
Cygwin path
  • Click on ok and validate
  • Cygwin is fully installed

Compilation with cygwin in Eclipse environment

Compilation with GCC

When creating a C/C++ project, the tool enables to select directly Cygwin GCC as compilation toolchain. Therefore the basic compilation configuration is set automatically.

Compilation with MinGW_64 GCC

To use a variant toolchain as MinGW_64, you first have to chose Cygwin GCC and then change the configuration of the used compilation toolchain. It has to be done only one time for the project to compile.

Steps:

  • Right click on the C++ code project in the Project Explorer tab (to generate your project in code, have a look on this page), and select Properties
  • In the tree, go to C/C++ Build > Settings
  • Change the command of Cygwin C+++ Compiler: change g++ by x86_64-w64-mingw32-g++
mingw settings: compiler

  • If you will use Tracing with MinGw change the command of Cygwin C Compiler: change gcc by x86_64-w64-mingw32-gcc
mingw c compiler for trace

  • Change the command of Cygwin C++ Linker: change g++ by x86_64-w64-mingw32-g++
mingw settings: linker

  • In Cygwin C++ Linker > Libraries, change the libraries settings
    • Replace boost_system by boost_system-mt (unless you are compiling code with Hub4Sys)
    • Replace libCWS_default by libCWS_minGW_x86_64
    • Remove rt
    • Add ws2_32
    • Add wsock32
mingw settings: libraries

警告

The order in which the libraries are organized can change the ouput of the compilation. If it doesn't work, try to rearrange the libraries as in the picture above, using the small icons representing up and down arrows.

信息

Proceed to the next step only if you intend to compile and build your code using Designer4Papyrus

  • In Cygwin C++ Linker > Miscellaneous, add linker flag -static
mingw settings: linker static