A few issues with cling related to MSVS 2010

Hi all.

I have installed llvm+clang+cling successfully on Windows (at least, all tools seem to be compiled without any errors). To be sure, I’ve done everything in a proper way, could anyone check if commands I typed are correct (disk label is D):

cd d:/
svn co http://llvm.org/svn/llvm-project/llvm/trunk@162185 llvm
cd ./llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
svn co http://root.cern.ch/svn/root/trunk/cint/cling
cd ../
cat ./tools/cling/patches/* | patch -p0
cmake -DSubversion_SVN_EXECUTABLE="C:/Program Files/SlikSvn/bin/svn.exe" -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER="c:/program files/Microsoft Visual Studio 10.0/VC/bin/nmake.exe" -DCMAKE_C_COMPILER="c:/program files/Microsoft Visual Studio 10.0/VC/bin/nmake.exe" ./

I’ve successfully loaded LLVM.sln file and built clang and cling solutions.

Now, if i launch cling.exe (llvm/bin/Debug/cling.exe), I receive the folowing:

D:\llvm\bin\Debug>cling.exe
In file included from input_line_1:1:
D:/llvm/tools/cling/include\cling/Interpreter/RuntimeUniverse.h:7:2: error: "This file must not be included by compiled
      programs."
#error "This file must not be included by compiled programs."
 ^
input_line_3:2:2: error: use of undeclared identifier 'gCling'; did you mean 'cling'?
 gCling=(cling::Interpreter*)48823732;
 ^~~~~~
 cling
D:/llvm/tools/cling/include\cling/Interpreter/ValuePrinter.h:16:11: note: 'cling' declared here
namespace cling {
          ^
input_line_3:2:2: error: unexpected namespace name 'cling': expected expression
 gCling=(cling::Interpreter*)48823732;
 ^
input_line_3:2:17: error: no member named 'Interpreter' in namespace 'cling'
 gCling=(cling::Interpreter*)48823732;
         ~~~~~~~^
input_line_3:2:29: error: expected expression
 gCling=(cling::Interpreter*)48823732;
                            ^

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$

Additionaly, this is what I got when tried to run #include :

[cling]$ #include <iostream>
In file included from input_line_4:1:
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:53: error: unknown type name 'type_info'
_CRTIMP int __cdecl _is_exception_typeof(_In_ const type_info &_Type, _In_ struct _EXCEPTION_POINTERS * _ExceptionPtr);

I know, there were a problems concerned with cling on Windows, but may be since then the situation have beed improved a little?

I’d appreciate if somebody could help me to get rid of all this issues. What am I doing wrong?

Thanks,
Sergey

Hi Sergey,
Unfortunately you are not doing anything wrong. It’s just a bug either in cling or clang on windows. RuntimeUnverse.h is cling startup file, which we protect from inclusion by any other compiled program. In order for cling (internally) to include that file we define -D__CLING__ directly in clang’s Preprocessor (using the dedicated for that API). It is really weird that piece of code works on every other platform but windows. I am still investigating, however, for now windows is not short-term priority and we will very much appreciate patches by our users.
Cheers,
Vassil

Hi vvassilev.
Thanks for clarifying the situation.

Hi,
I managed to find a workaround. Should be fixed in r45693
Cheers,
Vassil