How can clang (built with Visual Studio) work with MinGW gcc-toolchain?

Hi cfe-dev,

I downloaded the pre-built clang from llvm official download page. And find that it’s built with Visual Studio.
But locally I haven’t install Visual Studio yet.
My question is: How can clang work with my local pre-installed MInGW gcc-toolchain?

For eg:
If the design files include or something like header files, it will error out with following error message:

C:>“C:\Program Files\LLVM\bin\clang++.exe” main.cpp
main.cpp:1:10: fatal error: ‘cstdio’ file not found
#include
^
1 error generated.

So is there any option, like ‘-gcc-toolchain’ option on Linux platform to specify a header file path, to let the clang (build with Visual Studio) to find the header files AUTOMATICALLY, not though ‘-I’ option?

I tried ‘-gcc-toolchain’ on Windows platform, it cannot work, and put following warning message:

C:>“C:\Program Files\LLVM\bin\clang++.exe” main.cpp dut.cpp -gcc-toolchain “C:\mingw64”
clang++.exe: warning: argument unused during compilation: ‘–gcc-toolchain=C:\msys64\mingw64’

Thanks a lot!
Fangqing

Have you tried
-target x86_64-w64-mingw32
?

2018年2月2日(金) 7:27 Fangqing Du via cfe-dev <cfe-dev@lists.llvm.org>:

It works!
Thank you NAKAMURA!

Fangqing

Hi NAKAMURA,

If my local MinGW is installed at some other places, instead of C driver (default driver), how can clang find it automatically?

Thank you,
Fangqing