C++ program not compiling with Clang and visual Studio 2010 Express
Asked Answered
M

1

6

I'm trying to compile the source code as described in this tutorial with visual c++ 2010 express. http://kevinaboos.wordpress.com/2013/07/23/clang-tutorial-part-ii-libtooling-example/

The full source code is over here. https://github.com/kevinaboos/LibToolingExample

I have used the executable provided in this link to install LLVM. I can't post the complete error message due to formatting issues. But I will try to give as much information as I can. When I'm trying to build the solution , I get the following errors :-

argument unused during compilation warnings.
C:\Program Files (x86)\LLVM\include\llvm/Support/Compiler.h(57,1): error : LLVM requires at least MSVC 2012.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocnum(228,53): error : definition of dllimport static field not allowed
C:\Program Files (x86)\LLVM\include\llvm/ADT/IntrusiveRefCntPtr.h(26,9): fatal error : 'atomic' file not found

I'm using windows-7 64 bit. I've linked the header files and libraries by changing the project properties. I'm new to building c++ applications. Please help.

Monomania answered 13/6, 2014 at 4:32 Comment(5)
Would it work with MSVC2012 as suggested in the error message?Brain
i don't have visual c++ 2012Monomania
The error message seems pretty clearPesek
@SouravMukherjee If i remembered it correctly, MSVC is a free download.Brain
MSVC 2012 says :- VC\include\xstring(2195,3): error : cannot compile this try statement yet expanded from macro '_TRY_BEGIN' #define _TRY_BEGIN try { on compiling a simple hello world program. this is the hello world program i was trying to compile:- # include <iostream> using namespace std; int main() { cout<<"hello world"; } ... Please helpMonomania
H
10

For MSVC 2012 build error, found a solution here

According to Clang documentation, Exceptions and SEH are not supported yet. You have to disable it.

To disable exception in Visual Studio, please open Project Properties and go to C/C++, Preprocessor, then add _HAS_EXCEPTIONS=0 to Preprocessor Definitions.

Hadfield answered 15/7, 2014 at 5:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.