cpputest: CppUTest does not build via CMake using GCC 8.2.0 (mingw)
Issue
CppUTest does not build via CMake using GCC 8.2.0 (MinGW) on Windows.
I am trying to build CppUTest using CMake as indicated in Readme. I am using the exact CMakeLists script.
include(FetchContent)
FetchContent_Declare(
CppUTest
GIT_REPOSITORY https://github.com/cpputest/cpputest.git
GIT_TAG latest-passing-build # or use release tag, eg. v3.8
)
# Set this to ON if you want to have the CppUTests in your project as well.
set(TESTS OFF CACHE BOOL "Switch off CppUTest Test build")
FetchContent_MakeAvailable(CppUTest)
I am getting a localtime_s, fopen_s not found error on the build message.
[build] C:\Users\niel.cansino\XTX3_RH850EVM\build\_deps\cpputest-src\src\Platforms\Gcc\UtestPlatform.cpp: In function 'const char* TimeStringImplementation()':
[build] C:\Users\niel.cansino\XTX3_RH850EVM\build\_deps\cpputest-src\src\Platforms\Gcc\UtestPlatform.cpp:216:5: error: 'localtime_s' was not declared in this scope
[build] localtime_s(&lastlocaltime, &theTime);
[build] ^~~~~~~~~~~
[build] C:\Users\niel.cansino\XTX3_RH850EVM\build\_deps\cpputest-src\src\Platforms\Gcc\UtestPlatform.cpp:216:5: note: suggested alternative: 'localtime'
[build] localtime_s(&lastlocaltime, &theTime);
[build] ^~~~~~~~~~~
[build] localtime
[build] C:\Users\niel.cansino\XTX3_RH850EVM\build\_deps\cpputest-src\src\Platforms\Gcc\UtestPlatform.cpp: In function 'void* PlatformSpecificFOpenImplementation(const char*, const char*)':
[build] C:\Users\niel.cansino\XTX3_RH850EVM\build\_deps\cpputest-src\src\Platforms\Gcc\UtestPlatform.cpp:242:4: error: 'fopen_s' was not declared in this scope
[build] fopen_s(&file, filename, flag);
[build] ^~~~~~~
[build] C:\Users\niel.cansino\XTX3_RH850EVM\build\_deps\cpputest-src\src\Platforms\Gcc\UtestPlatform.cpp:242:4: note: suggested alternative: 'fopen'
[build] fopen_s(&file, filename, flag);
[build] ^~~~~~~
[build] fopen
Upon further researching on this matter, this seems that the compiler does not support the aforementioned methods. I tried changing my kit to Clang 3.9.1, and it passes the build. I’m curious at it was indicated in the Appveyor that the code builds on various MINGW Platform Toolset. What does the 4.8.x and 5.3.x indicate? Obviously they are not the GCC versions. A little bit of enlightenment is appreciated! Thank you.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (10 by maintainers)
Yup, well, the CppUTest-part is now fixed. This linker error doesn’t seem related 😃
Close now?