[cfe-dev] Testing Clang on Win32

Fernando Pelliccioni fpelliccioni at gmail.com
Thu Aug 19 12:56:07 PDT 2010


Hi,

I built Clang using the "Getting Started" & "Using Visual Studio" section.

A brief on my Platform:
    Intel Pentium D
    Microsoft Windows XP Service Pack 3

    Installed Compilers:
        Microsoft Visual Studio 9.0
        Microsoft Visual Studio 10.0

I ran cmake like the following

        cmake -G "Visual Studio 9 2008" .


I am trying to compile a simple C++ Hello World code.

    //helloworld.cpp
    #include <iostream>

    int main( /*int argc, char **argv*/ )
    {
        std::cout << "hello world\n";
        return 0;
    }


When I compiled helloword.cpp, I got errors from Visual Studio 10 Include
Directory.
Is there any way to specify to Clang where the Include directory is? I like
to use the MSVC 9.0 Include Dir.
How does Clang to assume that the compiler is VS2010? Remember that I chose
-- cmake -G "Visual Studio 9 2008" . --


Thanks,
Fernando.


------------------------------------------------------------------------------------------
Compile Errors:
------------------------------------------------------------------------------------------


> clang helloworld.cpp
In file included from helloworld.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/iostream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/istream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/ios:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/stdexcept:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/exception:38:
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/eh.h(58) :  error:
unknown type name 'type_info'
_CRTIMP int __cdecl _is_exception_typeof(_In_ const type_info &_Type, _In_
struct _EXCEPTION_POINTERS * _ExceptionPtr);
                                                    ^
In file included from helloworld.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/iostream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/istream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/ios:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/stdexcept:7:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xstring:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xmemory:7:
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/new(51) :  error:
exception specification in declaration does not match previous
      declaration
_Ret_bytecap_(_Size) void *__CRTDECL operator new(size_t _Size) _THROW1(_STD
bad_alloc);
                                     ^
note: previous declaration is here
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/new(79) :  error:
exception specification in declaration does not match previous
      declaration
_Ret_bytecap_(_Size) void *__CRTDECL operator new[](size_t _Size)
                                     ^
note: previous declaration is here
In file included from helloworld.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/iostream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/istream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/ios:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/stdexcept:7:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xstring:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xmemory:8:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xutility:8:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/utility:9:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/type_traits:7:
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/xtr1common(355) :
error: rvalue references are only allowed in C++0x
        struct _Remove_reference<_Ty&&>
                                    ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/xtr1common(368) :
error: rvalue references are only allowed in C++0x
        struct _Remove_rvalue_reference<_Ty&&>
                                           ^
In file included from helloworld.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/iostream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/istream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/ios:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/stdexcept:7:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xstring:6:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xmemory:8:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/xutility:8:
In file included from C:\Program Files\Microsoft Visual Studio
10.0\VC\include/utility:9:
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(243) :
error: rvalue references are only allowed in C++0x
        typedef _Ty && type;
                    ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(427) :
error: rvalue references are only allowed in C++0x
        struct is_rvalue_reference<_Ty&&>
                                      ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(554) :
error: '_From' does not refer to a value
        struct is_convertible _IS_CONVERTIBLE(_From, _To)
                              ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits:554:40:
note: instantiated from:
        struct is_convertible _IS_CONVERTIBLE(_From, _To)
                                              ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(553) :
note: declared here
template<class _From, class _To>
               ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(555) :
error: expected class name
        {       // determine whether _From is convertible to _To
        ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(720) :
error: expected expression
        struct has_nothrow_constructor _HAS_NOTHROW_CONSTRUCTOR(_Ty)
                                       ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits:42:36:
note: instantiated from:
        : _Cat_base<is_pod<_Ty>::value || __has_nothrow_constructor(_Ty)>
                                          ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(721) :
error: expected class name
        {       // determine whether _Ty has a nothrow constructor
        ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(726) :
error: expected expression
        struct has_nothrow_copy _HAS_NOTHROW_COPY(_Ty)
                                ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits:44:36:
note: instantiated from:
        : _Cat_base<is_pod<_Ty>::value || __has_nothrow_copy(_Ty)>
                                          ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(727) :
error: expected class name
        {       // determine whether _Ty has a nothrow copy constructor
        ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(733) :
error: expected expression
        struct has_nothrow_default_constructor _HAS_NOTHROW_CONSTRUCTOR(_Ty)
                                               ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits:42:36:
note: instantiated from:
        : _Cat_base<is_pod<_Ty>::value || __has_nothrow_constructor(_Ty)>
                                          ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(734) :
error: expected class name
        {       // determine whether _Ty has a nothrow constructor
        ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(739) :
error: expected expression
        struct has_nothrow_copy_constructor _HAS_NOTHROW_COPY(_Ty)
                                            ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits:44:36:
note: instantiated from:
        : _Cat_base<is_pod<_Ty>::value || __has_nothrow_copy(_Ty)>
                                          ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(740) :
error: expected class name
        {       // determine whether _Ty has a nothrow copy constructor
        ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(746) :
error: expected expression
        struct has_nothrow_assign _HAS_NOTHROW_ASSIGN(_Ty)
                                  ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits:46:36:
note: instantiated from:
        : _Cat_base<is_pod<_Ty>::value || __has_nothrow_assign(_Ty)>
                                          ^
C:\Program Files\Microsoft Visual Studio 10.0\VC\include/type_traits(747) :
error: expected class name
        {       // determine whether _Ty has a nothrow assignment operator
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]


------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100819/caaa11ac/attachment.html>


More information about the cfe-dev mailing list