簡體   English   中英

錯誤:在mingw64上構建cmake + boost項目時,“ GetSystemTimeAsFileTime”的類型沖突

[英]error: conflicting types for 'GetSystemTimeAsFileTime' while building cmake+boost project on mingw64

嘗試使用Mingw64構建基於CMake和Boost的C ++項目。 我安裝了cmake並增強了msys2-mingw64軟件包。 獲取有關GetSystemTimeAsFileTime類型沖突( LPFILETIMEFILETIME )的錯誤。

$ 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM