I had a similar problem and found that I needed to add the pthread library to my MinGW / Msys installation. I re-ran the MinGW Installation Manager (using mingw-get) and added the mingw32-pthreads-w32-* and mingw32-w32api-dev packages to my installation. I then needed to re-run the configuration tool (./configure) and remake the cpputest executable.
e.g.
autoreconf . -i (probably not necessary, no new output generated)
./configure --build=x86_64-pc-linux-gnu --host=mingw32 (see note below)
make clean
make tdd
After running configure, the CppUTest report shows that the CppUTest LIB is using pthread
----------------------------------------------------------------
CppUTest Version 3.8
Current compiler options:
CC: mingw32-gcc
CXX: mingw32-g++
LD: c:/mingw/mingw32/bin/ld.exe
Default CFLAGS: -g -O2
Default CXXFLAGS: -g -O2
CppUTest CFLAGS: -Wno-c++11-long-long -Wno-long-long -Wall -Wextra -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -pedantic -Wsign-conversion -Wno-disabled-macro-expansion -Wno-padded -Wno-reserved-id-macro -Wno-keyword-macro
CppUTest CXXFLAGS: -include ./include/CppUTest/MemoryLeakDetectorNewMacros.h -Wno-c++14-compat -Wno-c++11-long-long -Wno-long-long -Wall -Wextra -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -pedantic -Wsign-conversion -Woverloaded-virtual -Wno-disabled-macro-expansion -Wno-padded -Wno-reserved-id-macro -Wno-keyword-macro -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables -Wno-old-style-cast
CppUTest CPPFLAGS: -include ./include/CppUTest/MemoryLeakDetectorMallocMacros.h -I ./include
CppUTest LDFLAGS:
CppUTest LIB: -lpthread
Note regarding the use of the --host and --build options for the configure command:
When issued without parameters "./configure" the script would fail on my Win10 64 bit machine when checking for cross compiling
checking whether we
are cross compiling... configure: error: in `/c/tools/cpputest':
configure: error: cannot run C
compiled programs.
If you meant to
cross compile, use `--host'.
See `config.log'
for more details
From another support site, another user discovered that this error was caused by his antivirus software deleting the temporary test executable that the script was trying to run before the script had a chance to run it. I found that supplying the --host and --build parameters allowed configure to continue past this point and complete successfully. I obtained my --host and --build values from the configure.log file (in my case line 111):
Configured
with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 …