Clang在Windows中编译兼容Linux API的代码

首先要有MinGW兼容的编译器,在编译选项中增加-target x86_64-pc-windows-gnu即可。

选择x86_64-pc-windows-gnu目标而非Windows平台上Clang默认的x86_64-pc-windows-msvc目标。

参考

  1. How to use clang with mingw-w64 headers on windows - Stack Overflow