4

I googled a lot and didn't find an appropriate answer, so I'm asking here.

What steps do I need to take to develop a c++ project from existing code which shall be compiled using cmake and clang?

I also want to have all the nice features like auto-completion and debugging with breakpoints and step by step debugging.

Rico-E
  • 1,806
  • 2
  • 28
  • 47
  • Very relevant: http://stackoverflow.com/questions/2487931/llvm-c-ide-for-windows – Oak Oct 22 '13 at 09:04
  • I already found that, but visual studio isn't mentioned in the results. And I also found http://llvm.org/builds/ where they say, that it works with visual studio. So the question is: How do I have to configure VS that it works with llvm and clang. – Rico-E Oct 22 '13 at 09:06
  • _I also want to have all the nice features like auto-completion and debugging with breakpoints and step by step debugging._ - In that case you are out of luck for now. Clang support on Windows is still in its early stages and we are nowhere near that amount of comfort yet. – ComicSansMS Oct 22 '13 at 15:44

2 Answers2

3

See the recent LLVM snapshot page for Windows builds integrating with Visual Studio here. There is an installer and a code formatting plugin. You will not get auto-complete and Clang/LLVM has nothing to do with debugging in Visual Studio (except that it will probably not work if you compile with Clang).

See also this interesting blog post predicting much good for LLVM on Windows in the future, backed by companies with paid developers ;-)

rubenvb
  • 74,642
  • 33
  • 187
  • 332
  • thank you for your answer. I already found the pages you mentioned. But none of them tells me, how to set up Visual Studio to use cmake and Clang/LLVM. – Rico-E Oct 22 '13 at 09:55
  • You can use recent (currently git master) CMake and tell it to use clang. I don't know if the VS project file generator is capable of handling that though. If it is, you should be able to load it into VS and compile with Clang. – rubenvb Oct 22 '13 at 11:44
  • I tried something that sounds similar to what you suggested, but I'm not sure if it's truely the same. But what I've tried did not work. Can you test what you suggested, and tell me whether it works or not? – Rico-E Oct 22 '13 at 12:50
  • @Rico-E Sorry, I don't have VS installed. If it doesn't work, I bet it's just not yet possible. People are still hard at work making the LLVM compiler/linker work on Windows, so don't expect build tools to be up to speed here. Also, unless Clang gets a cl-like frontend, don't get your hopes up of decent VS build system integration. Currently, Clang understand GCC-like commandline arguments, and VS is very specialized on its own compiler frontend. – rubenvb Oct 22 '13 at 13:05
  • Once you install LLVM package you are probably missing this step: To use the LLVM toolchain from Visual Studio, select a project in Solution Explorer, open its Property Page (Alt+F7 by default), and in the "General" section of "Configuration Properties" change "Platform Toolset" to "LLVM-vs2012", "LLVM-vs2013", etc. – Огњен Шобајић Mar 24 '15 at 08:32
1

Staying on top of what the clang guys are doing for Windows is a good idea. The last two releases 3.6 and 3.7 show a commitment to the product but still some holes: MSVC C++: /Z7 but not quite /Zi debug information, not quite compatible with MSVC C++ exceptions (but Windows SEH works) meaning this is more like an auxiliary build tool at the moment than something you can build any running product on. I concur with the problems with exceptions at the moment.

I haven't got the strakh to post more than two links but the intervening weekly notes, have lots of interesting snippets including the coming of lldb to Windows and (if you care for this sort of thing) a longer post on compiling for CLR on Windows. Either way, looking at blog.llvm.org regularly is a good idea to keep this answer current.

AGE
  • 3,752
  • 3
  • 38
  • 60