[英]Building gRPC and openssl as dependency with cmake for msys2/mingw64 fails with undefined references
[英]error: conflicting types for 'GetSystemTimeAsFileTime' while building cmake+boost project on mingw64
尝试使用Mingw64构建基于CMake和Boost的C ++项目。 我安装了cmake并增强了msys2-mingw64软件包。 获取有关GetSystemTimeAsFileTime
类型冲突( LPFILETIME
与FILETIME
)的错误。
$ cmake --build .
[ 1%] Building CXX object CMakeFiles/...
In file included from ....cpp:1:
In file included from C:/msys64/mingw64/include\boost/thread.hpp:13:
In file included from C:/msys64/mingw64/include\boost/thread/thread.hpp:12:
In file included from C:/msys64/mingw64/include\boost/thread/thread_only.hpp:15:
In file included from C:/msys64/mingw64/include\boost/thread/win32/thread_data.hpp:10:
In file included from C:/msys64/mingw64/include\boost/thread/thread_time.hpp:10:
In file included from C:/msys64/mingw64/include\boost/date_time/microsec_time_clock.hpp:23:
C:/msys64/mingw64/include\boost/date_time/filetime_functions.hpp:57:46: error: conflicting types for 'GetSystemTimeAsFileTime'
__declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(FILETIME* lpFileTime);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\sysinfoapi.h:38:26: note: previous declaration is here
WINBASEAPI VOID WINAPI GetSystemTimeAsFileTime (LPFILETIME lpSystemTimeAsFileTime);
^
以及许多其他类似的错误。
mingw64软件包中的错误? 缺少定义?
原来必须定义BOOST_USE_WINDOWS_H
。
修复CMake项目:
if(WIN32)
add_definitions(-DBOOST_USE_WINDOWS_H)
endif()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.