First of all, I've followed "Getting Started: Building and Running Clang". In particular, I've built it according to "Using Visual Studio" section. In other words, I've built it using Visual Studio 2010.
Secondly, I've manually set include and library paths to MinGW distribution:
The simple program I'm trying to compile:
#include <iostream> using namespace std; int main() { cout << "Hello, World!" << endl; return 0; }
I get the following feedback from the compiler:
In file included from C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\iostream:39: In file included from C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\ostream:39: In file included from C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\ios:38: In file included from C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\iosfwd:41: In file included from C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\bits/postypes.h:41: C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar:144:11: error: no member named 'fgetws' in the global namespace using ::fgetws; ~~^ C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar:146:11: error: no member named 'fputws' in the global namespace using ::fputws; ~~^ C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar:150:11: error: no member named 'getwc' in the global namespace using ::getwc; ~~^ C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar:151:11: error: no member named 'getwchar' in the global namespace using ::getwchar; ~~^ C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar:156:11: error: no member named 'putwc' in the global namespace using ::putwc; ~~^ C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\cwchar:157:11: error: no member named 'putwchar' in the global namespace using ::putwchar; ~~^ 6 errors generated. Build error occurred, build is stopped Time consumed: 646 ms.
The obvious question is - why do I get this?
Additionally, I would like to know more details, and since, Clang website provides extremely brief information - I thought that somebody could clarify the following questions to me:
clang/lib/Frontend/InitHeaderSearch.cpp
or I can skip it and rather specify those paths later through "-I" option as I do in the screenshot above?For best IDE support in Visual Studio, we recommend using the latest Clang compiler tools for Windows. If you don't already have the tools, you can install them by opening the Visual Studio Installer and choosing C++ Clang tools for Windows under Desktop development with C++ optional components.
Open a Terminal window. Enter the command clang --version to see if the Clang compilers are already installed.
Clang is much faster and uses far less memory than GCC. Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics.
If you build Clang with MSVS, it will automatically search the default VS include paths, and pull in those headers. This is the reason the libstdc++ headers are producing errors: they are importing C functions not present in the VS headers. Using Clang for C++ with VS is for now a no-go: you will get link failures due to missing ABI (name mangling and others) functionality in Clang. If you still want to use the MSVS Clang, don't point it to MinGW headers. It will parse the VS headers (including C++), it just will fail to link.
EDIT: I have built a dw2 version of GCC (32-bit only) accompanied by Clang. Exceptions work in this build, and so you can build real C++ stuff with Clang now on Windows. Get version 3.2 here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With