test demo project

If you develop under Windows with C/C++ you do not necessarily have to use Microsoft Visual Studio. This blog series shows alternatives based on free software and available for all operating systems. This can be an advantage if a team uses different operating systems and still wants to use the same toolchain. Furthermore, the alternatives are free of charge.

To demonstrate the use of the presented toolchains we use the Google Test demo project on GitHub.


MinGW stands for Minimalist GNU for Windows and is a collection of open source tools for software development for Windows. The included tools are:

The Gnu Compiler Collection (GCC) with compilers for C, C++, Fortran and ADA

Tools for creating archives, dynamically loadable libraries and executable files

Gnu Debugger (GDB) and other tools like gcov for code coverage analysis.

Unlike Cygwin, which we will cover in the next blog, the programs you create with MinGW do not use their own runtime library. Instead, they use the Microsoft libraries that are part of every Windows installation. Therefore, there are no licensing problems when using MinGW.

MinGW is available for Linux and MacOS, allowing cross compilation for Windows on these platforms.


MinGW-w64 was started in 2005 by OneVision to port an Objective-C application to Windows. The authors of MinGW did not want to adopt the code because of licensing concerns, as OpenVision developed the Windows API using a clean room implementation. Therefore OneVision released the project as a fork of MinGW on Sourceforge in 2008. Currently there are about 20 developers working on the project. MinGW-w64, unlike MinGW, can also create 64-bit binaries and supports more features of the Windows API. Also the attempt of the author to translate Google Test with MinGW failed. With MinGW-w64 this is possible without problems. Like MinGW, MinGW-w64 is available for all common operating systems.


Basically there are two ways to implement concurrency: Either you use the Windows API (_beginthread, _cwait, etc.) to create and manage threads or you use the Posix-compliant Pthreads library. The advantage of the latter variant is that the code can be compiled for any Posix-compliant system such as Linux and MacOS.

Unfortunately, the C++ Thread support library is not implemented by the standard library provided with MinGW-w64. However, there is an implementation for MinGW on GitHub: mingw-std-threads. Another portable alternative is Boost Thread.

Google Test Demo Project

In the following we will download, translate and run the demo project step by step. For this we need:

  • Git
  • Cmake
  • MinGW-w64
  • Ninja
  • Python 2.7

After installing all required packages, we clone the demo project:

git clone https://github.com/bast/gtest-demo

Then we create a directory in which we will translate the project and change to this directory:

mkdir gtest-demo\build
cd gtest-demo build

The demo project uses an old Google test release that does not work with MinGW. Therefore we change the Google Test version from 1.8.0 to 1.10.0. To do this we open the file gtest-demo/cmake/googletest-download.cmake and change line 10:

@@ -12,7 +12,7 @@ ExternalProject_Add(
– release-1.8.0
+ release-1.10.0

Now we let CMake create the ninja build system:

cmake -G Ninja ..

And translate the project with:

cmake –build .

Now we can run the demo project:


And when we have done everything right, we will see this test report:

[==========] Running 2 tests from 1 test suite.
[———-] Global test environment set-up.
[———-] 2 tests from example
[ RUN ] example.subtract
[ OK ] example.subtract (0 ms)
[ RUN ] example.add
[ OK ] example.add (0 ms)
[———-] 2 tests from example (11 ms total)

[———-] Global test environment tear-down
[==========] 2 tests from 1 test suite ran. (30 ms total)
[ PASSED ] 2 tests.

Background vector created by iconicbestiary – www.freepik.com

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.

Privacy Settings saved!
Privacy Settings

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.

GetResponse, Google Analytics

We use LinkedIn Insight for marketing purposes. You can disable these cookies.

We use Google Analytics for marketing purposes. You can disable these cookies.
  • __utmz
  • __utma
  • _ga
  • _gat

We use GetResponse for marketing purposes. This service cannot be disabled, otherwise the website functions will be limited.

Decline all Services
Accept all Services
Get Free Access Now to
9 eBooks!
All about Automated Software Testing
Proven experts
Learn to save up to 75% of your test efforts
Get Free Access Now!
Get Access Now! & Save 50%
Personal Trainer FREE Nutrition Custom Workout App
Get Access Now!
eBook Download
Enter your details to get your free ebook!
All about Automated Software Testing
Download Free Ebook
Lorem ipsum dolor sit amet, consectetur adipiscing