Skip to content

Building on Windows with MinGW fails #971

@itavero

Description

@itavero

Just tried opening the project in CLion (uses CMake and MinGW) on Windows and got errors about the redefinition of struct timespec in pthread.h (already defined in time.h).

R:\apps\jetbrains\clion\bin\cmake\bin\cmake.exe --build C:\Users\Arno\.CLion2016.1\system\cmake\generated\cpputest-57d1066f\57d1066f\Debug --target CppUTestTests -- -j 8
[  1%] Building CXX object src/CppUTest/CMakeFiles/CppUTest.dir/__/Platforms/Gcc/UtestPlatform.cpp.obj
In file included from R:\projects\github\cpputest\src\Platforms\Gcc\UtestPlatform.cpp:49:0:
c:\mingw\include\pthread.h:320:8: fout: redefinition of ‘struct timespec’
 struct timespec {
        ^
In file included from c:\mingw\include\time.h:53:0,
                 from c:\mingw\include\sys\time.h:3,
                 from R:\projects\github\cpputest\src\Platforms\Gcc\UtestPlatform.cpp:35:
c:\mingw\include\parts\time.h:105:8: fout: previous definition of ‘struct timespec’
 struct timespec
        ^
mingw32-make.exe[3]: *** [src/CppUTest/CMakeFiles/CppUTest.dir/__/Platforms/Gcc/UtestPlatform.cpp.obj] Error 1
mingw32-make.exe[2]: *** [src/CppUTest/CMakeFiles/CppUTest.dir/all] Error 2
mingw32-make.exe[1]: *** [tests/CMakeFiles/CppUTestTests.dir/rule] Error 2
src\CppUTest\CMakeFiles\CppUTest.dir\build.make:512: recipe for target 'src/CppUTest/CMakeFiles/CppUTest.dir/__/Platforms/Gcc/UtestPlatform.cpp.obj' failed
CMakeFiles\Makefile2:980: recipe for target 'src/CppUTest/CMakeFiles/CppUTest.dir/all' failed
CMakeFiles\Makefile2:1104: recipe for target 'tests/CMakeFiles/CppUTestTests.dir/rule' failed
Makefile:562: recipe for target 'CppUTestTests' failed
mingw32-make.exe: *** [CppUTestTests] Error 2

This issue seems to be similar too what the Oxygine project experienced, see: oxygine/oxygine-framework#34 (so perhaps the fix will be the same too).
I'll try to apply the similar changes to the CMake configuration to see if that helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions