Skip to content
Alexander Saprykin edited this page Sep 10, 2023 · 28 revisions

Configurations

Version Compilers Status Tests
Windows 7 SP1 (x64) MinGW GCC 5.3.0 (x86, x64) Compiled Passed
Windows 7 SP1 (x64) Clang 3.9.0 (x86, x64) Compiled Passed
Windows 7 SP1 (x64) Intel XE 2013 (x86, x64) Compiled Passed
Windows 7 SP1 (x64) Visual Studio 2012 (x86, x64) Compiled Passed
Windows 7 SP1 (x64) Visual Studio 2015 (x86, x64) Compiled Passed
Windows XP SP3 (x86) Visual Studio 2015 (x86) Compiled Passed
Windows XP SP3 (x86) Borland 5.82 (x86) Compiled Passed
Windows XP SP3 (x86) Open Watcom 1.9 (x86) Compiled Passed

Regular test builds are run on AppVeyor.

If you need IPv6 support on Windows XP you must enable it manually using the following command: netsh int ipv6 install. Without enabled IPv6 all calls related to IPv6 addresses and sockets will fail.

MinGW

MinGW-W64 is an advance of the original MinGW project to provide GCC support on Windows including 64-bit API. It has easy-to-use online installer where you can select all required packages. You should have no problems with compilation using MinGW-W64.

MSYS2 provides POSIX environment to build native Windows binaries. After installing core MSYS2 distribution you need to install required MinGW-W64 toolchains and utilities: look for mingw-w64-i686-* and mingw-w64-x86_64-* package prefixes. You need at least GCC and make utility which provides mingw32-make binary. CMake is also available for the each of toolchains. You may need to explicitly pass to CMake name of the make utility and project generator: -DCMAKE_MAKE_PROGRAM=mingw32-make -G"Unix Makefiles". You can read more about MSYS2 on its page.

MinGW-W64 (GCC) builds with version greater than 4.9.x may have some problems with optimizations which can lead compiled programs to unpredictable crashes. In that case you can try to compile code with -fno-aggressive-loop-optimizations flag (introduced in GCC 4.8.0), or disable optimisations completely (-O0 flag).

Note. You must use MinGW-W64 shell to build native binaries, do not use MSYS2 shell directly.

Clang

Clang on Windows is still some sort of an exotic, but the situation is better with the every release. There are three general ways to use Clang on Windows:

  • Starting from Visual Studio 2015 Update 1 Microsoft offers out-of-the box Clang experience. Read about Clang support in Visual Studio. You can also read more about supported features. Actually it is a Clang parser with Visual Studio's code generator and optimizer.
  • Official Windows builds of Clang add custom toolsets into Visual Studio (i.e. LLVM-vs2014), as well as precompiled Clang binaries. In the newer versions of CMake you can pass a toolset name using -T option. This way you can use original Clang compiler for Visual Studio projects. Latest CMake refuses to work with these toolsets. But you can also use Clang binaries directly, do not forget that you need the MSVC-like frontend binary clang-cl.exe, not the clang.exe or clang++.exe. Just use a Visual Studio generator and replace the C compiler variable CMAKE_C_COMPILER with Clang one.
  • MSYS2 provides prebuilt packages of the latest Clang versions. Use pacman to install it. It is a native Clang compiler and the most easiest and good working path. Though it is working only for x64 builds.

If you are going to build Clang by yourself this manual is quite a good starting point.

Intel

Using Intel C/C++ compiler is straightforward: setup development environment using supplied scripts with appropriate Visual Studio version and target architecture (Intel doesn't supply linker). Run CMake from the prepared environment and point out path to Intel C/C++ compiler for selected target architecture.

Visual Studio

Easiest way to integrate the library into the Visual Studio is to use vcpkg packaging tool which provides lot of packages out of the box. It supports builds for Visual Studio 2015 and 2017.

Using Visual Studio is really easy: run CMake, choose required solution generator, run it and open generated solution in Visual Studio.

Open Watcom

Open Watcom is an open source compiler with cross-compiling support. Works without issues.

Borland

Borland C++ is a compiler developed by Borland and CodeGear. Now it is developed by Embarcadero. I do not recommend you to use versions prior 5.7 (Borland C++ Builder 2006) because they have brain-damaged socket subsystem implementation which is not fully compatible with WinSock2 behavior.

Clone this wiki locally