Does Microsoft Visual C++ support WebAssembly as a target? - c++

I know many people are using Rust and a few other languages to experiment with WebAssembly.
And I know that people using WebAssembly with C/C++ are mostly using Clang/LLVM.
But I can't seem to find any information at all on whether MSVC can compile C/C++ to wasm binaries, whether there's any kind of beta or developer preview, or whether it's on a future roadmap or feature request, etc.
I know Edge supports wasm and Microsoft is listed as one of WebAssembly's developers on the wasm Wikipedia page.
But what about generating wasm from MSVC? Any info on that?

C++ now supports WebAssembly using some toolchains like llvm/emscripten, but VC++ does not support it currently. The good news is that VC++ developers have noticed this:
We will do some preliminary checks to make sure we can proceed further. (2018/12/14)
For more information, you can check out these links: Targeting WebAssembly with C++ in Visual Studio IDE? and https://developercommunity.visualstudio.com/idea/457758/add-emscriptenwebassembly-support.html

Related

LLVM 3.4 integration with VS 2012

I have read online documentations and built LLVM using Cmake and visual studio using Getting Started with the LLVM System using Microsoft Visual Studio. I could not find how to use the LLVM tooolchain on an existing visual studio project. I am new to this environment and would appreciate any help.
EDIT 1 : I am contributing to a project, where I am required to build an Interpreter. The project restricts me to code in VS.
Here are the errors when I try to integrate LLVM and VS, I must be doing something terribly wrong LLVM compilation errors on VS 2012
EDIT 2: I am unclear as to how should we integrate LLVM in an existing VS project after a successful LLVM build (and installation on system).
EDIT 3: I aim to develop my own language utilizing clang/llvm. I cant figure out how to do this sitting in the VS enironment.
The instructions you have followed are not supposed to produce a "plug-in replacement for Visual Studio's provided compiler", but a way to, generally, build LLVM+CLANG - and of course, unless you are wanting to spend a lot of work [1], to build a compiler written in C++, you need an existing C++ compiler - and the instructions show how to do that with Visual Studio. You then have a clang and clang++ compiler and tools on your system, but it's not meant for "use it within Visual Studio".
From what I can tell from past experience, the Visual Studio compiler is not trivially replaceable, but you can of course use a Makefile Project to compile anything in any way you like.
This discussion from MS does provide another solution, but again, it's not a "instant plug in" solution:
http://social.msdn.microsoft.com/forums/vstudio/en-US/b9610ed2-e8ae-48c9-864c-e3d12af97b05/support-an-alternative-compiler
Some further googling shows this up:
https://github.com/ishani/ClangVSx
I have no idea if that works well or not - it seems to "only" support clang 3.3, where the current release is 3.4 and the "latest" is pre-3.5. I doubt there's a huge amount of difference, but I'm also not sure that there's "no difference".
[1] You can "bootstrap" a compiler from nothing, but it's really quite a lot of work writing a small compiler that can do a subset of the language, repeat this several times, to eventually compile the actual compiler in a more full compiler - and LLVM is not even nearly designed for that in the first place.

build toolchain with cmake, clang and llvm for visual studio

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.
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 ;-)
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.

Best alternative for Visual C++? VS11 Express can't be used to write desktop apps

Some of you might already know that Microsoft is trying to kill desktop development in favor of Metro style apps. The express editions of the new Visual Studio 11 will only support writing Metro style apps. They also won't give you the new compilers as part of the new Windows SDK. The only way to get the compilers is to buy Visual Studio Professional or higher.
Now it's time to find an alternative (alternative compilers for the Windows platform). Any suggestions?
Some links that are related to this issue:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2645679-visual-studio-11-express-on-windows-7-and-the-abil
http://blogs.msdn.com/b/visualstudio/archive/2012/05/18/a-look-ahead-at-the-visual-studio-11-product-lineup-and-platform-support.aspx
http://www.microsoft.com/visualstudio/11/en-us/products/express
Gcc/G++ of course. In my opinion it is superior to VC++. In addition, you can use Eclipse CDT as IDE, it is quite usable at the moment (compared to older versions). I work like that on Windows. In addition, you can also work on Linux or MacOS without having to switch to another tool.
1) The Metro and WinRT features are accessible from C++/CX which in turn is built on top of COM, so according to this detailed discussion (SO question on WinRT and C) you can use the latest "Microsoft-only" features with any decent C compiler. Of couse this will require some code generation or just a lot of typing to get the access to basic facilities. I believe there would be a transition period and then the open-source community comes up with some automated solution to consume the WinRT APIs.
2) A quick list of available options right now.
Dev tools: MinGW or Cygwin (GCC toolchain + unix-like tools), Clang maybe, OpenWatcom as a thing from the past
GUI Libraries: FLTK, Qt, wxWidgets, Fox GUI toolkit, librocket (if you are into the OpenGL world)
IDEs: Code::Blocks, Eclipse+CDT, QtCreator
3) There's also a non-C++ way:
The FreePascal+Lazarus to allow Delphi-like RAD
Mono/SharpDevelop
Both options can use C++ code with some bindings.
4) Conclusions
These are the alternatives which give similar results but not always the similar level of comfort.
Yet another possibility would be Qt Creator, which comes with a full toolset targeting Windows (as well as MacOS, Linux, and Symbian). It is definitely somewhat different from VS, so it takes some getting used to, but overall I'd rate it as pretty decent. Qt (the library) generates somewhat mixed feelings -- some dislike its oddities (E.g., MOC), but quite a few consider it the best designed GUI toolkit available.
Don't forget the Netbeans GUI which is also available for windoze. It works great, just install mingw and choose this mingw/bin directory for the compiler tools and mysys/bin/make.exe as the make program
to download
https://netbeans.org/downloads/index.html
they have this plugin for vc++
http://plugins.netbeans.org/plugin/42519/vcc4n-visual-c-compiler-for-netbeans
some install info
https://netbeans.org/community/magazine/html/03/c++/
Another IDE that I havent used but looks good is
http://www.codeblocks.org/

clang-based cross-platform C++ IDE?

The clang C++ compiler claims to be built for, among other things, better IDE integration by providing an API for the IDE to use for tasks such as parsing the code.
So, are there are any good C++ IDE's that use clang to provide features such as semantic highlighting, refactoring, and finding and showing semantic errors in real-time?
I've been using Eclipse CDT, but its C++ parser is full of imperfections that cause the IDE to report a lot of annoying false positive errors in the code. I would like to have an IDE that reports an error if and only if the compiler would report the same error, hence my interest in an IDE that's built on a compiler's internals.
I'm primarily interested in cross-platform IDE's, although I wouldn't mind knowing about single-platform ones for Windows or Linux (so not Xcode), as long as they are FOSS (another reason why not Xcode).
Qt Creator is basing their next-gen code parsing and associated functionality on Clang:
https://www.qt.io/blog/2011/10/19/qt-creator-and-clang
Looks very, very promising!
have you tried clang complete?
if you're punk rock, then vim is enough ide ;)
i often work with xcode so... can't really share firsthand experience, but i knew of its existence.
gedit isn't really an IDE, but there is a plugin for it that provides code assistance using clang
It seems that CodeLite v3.5 starts supports Clang natively. However I haven't found is it possible to setup LLVM as backend.
A relevant new development in this area in the Language Server Protocol (LSP) project, which aims to be a language-agnostic API that allows editors / IDEs to be decoupled from backends that provide code intelligence / analysis.
There is ongoing work to create a clang-based C++ backend called Clangd.
There is also ongoing work on several editors / IDEs to support the LSP as a client.
Once the backend implementation matures, all editors supporting the LSP will, in principle, be able to leverage clang's capabilities as exposed through Clangd.
KDevelop now has clang based c and c++ support, including semantic analysis and autocomplete. It is primarily for linux but (as of October 2016) has a beta release out for windows and mac as well.
For emacs there are irony-mode and rtags that provide features such as auto-complete, on fly error checking and jump to symbol. When combined with cmake-ide they are very powerful tools and one well versed in emacs can be highly productive in this environment.
Not FOSS, but JetBrains (of IDEA and ReSharper fame) are building out their AppCode product into a full C++ IDE supporting Win/Linux/Mac and using clang.
Yes, really.
jucipp
~900 stars on GitHub in 2019Q2: https://github.com/cppit/jucipp
Now moved to GitLab: https://gitlab.com/cppit/jucipp
Clearly advertises libclang backend as a main feature.

Optimal Eclipse CDT (C++) experience in March of 2010

I am a student who will be using C++ next quarter. I really enjoyed using the Galileo release of Eclipse with Java and I would like to continue using Eclipse for for C++ development.
I am now experimenting with C++ development on Eclipse. I am running Eclipse 3.5 SR2 with CDT 6.02. My operating system is Windows 7 and I have installed MinGW-5.1.6. Version 6.3 of GDB is installed.
I have it compiling and stepping through code. However, I have the suspicion that I'm just crawling along and have yet to "shift the car out of first gear". I've spent about a week poking around on the Web to learn what constitutes and "optimal" C++ Eclipse experience. In particular, I'm interested in round-tripping with UML and unit testing.
My exploration of the Web became an archeological dig. I turned up how-to articles from 2003, alternative MinGW distros, references to plugins, dead-links, more references to plugins, passionate discussions on gdb bugs, and more references to plugins.
I no longer have any idea what might constitute an optimal C++ Eclipse environment. Would members of the community like to weigh-in on what they consider to be the current optimal experience for C++ development using Eclipse?
CDT 7.0 (out now in June) will have a preview of Codan, a static analysis framework for C/C++. It will highlight logic errors for you in "realtime", i.e. without having to wait for compilation. (It doesn't have very many checkers at the moment, but the number is growing, and you can also implement checkers of your own.)
CDT 7.0 also features a new debugger contributed by Nokia (called "EDC"), which allows debugging without relying on 3rd party tools such as gdb. This will also allow debugging of Visual Studio binaries, something which previously has been impossible.
The "Open Type" and "Open Resource" commands of CDT (and JDT also, BTW) is something I always miss when I have to do stuff in Visual Studio. Being able to locate any type by incrementally typing a part of its name is very practical, and Visual Studio has nothing close to it.
Integration with unit-testing is still missing, though. Not sure why that hasn't caught on.
Here is what I ended up with for a C++ development environment on Windows 7.
Compiler & libraries
Nuwen MinGW Distro.
It includes the Boost libraries which are necessary for the unit testing framework.
A big thanks to Stephan T. Lavavej for making this distribution available.
Debugger
The GNU debugger as built for Windows.
I copied the file gdb.exe into my C:\MinGW\bin folder and it worked well.
Thanks for Equation Solution for providing win32 and win64 binaries of the GDB executable.
IDE
Eclipse IDE for C/C++ Developers.
Unit testing framework
CUTE (C++ Automated Unit Testing Easier).
Download the Eclipse plug-in using Eclipse’s software installation . Add this URL to “Available Software Sites”: http://ifs.hsr.ch/cute/updatesite.
The CUTE Website has excellent installation and usage instructions.
I failed to find a round-trip modeling tool that was useful to me. Exploring free UML tools was like wandering through a city that had been bombed. Dozens of projects stood in various states of usability. Some projects were clearly active, some were clearly abandoned, but most were somewhere in between. Visio continues to be my pragmatic choice for creating UML models.
Seeing as none of the C++ gods here on SO have weighed in...
My last experience with CDT was about 1 year ago. I too love eclipse for Java, and while CDT "did the job", I didn't feel like it did it any better than Code::Blocks which I used for cross platform development.
Eclipse does have access to UMLet which is my favorite UML tool as it uses a very simple scripting language instead of the 'mouse-click-drag-double-click-type' hell that most UML applications turn out to be. However, UMLet can also be used as a standalone application which makes tucking it into eclipse accomplish little more than wasting screen real-estate.
In the end, I really don't think you are going to find many professionals developing in CDT.
On the linux side you are going to find developers using what they wish to use (Anjuta, Code::Blocks, Dev-C++, kdeveloper, EMACS, vim, etc.)
On the Windows side you'll find Visual Studio overwhelmingly followed by the IDE's above that happen to be cross platform.
In the end, if I HAD to develop in Eclipse; I would use CDT, UMLet, and Subclipse. After having done that I would probably long for my TortoiseSVN, Visual Studio, Code::Blocks, and UMLet standalone.
As far as any automated unit testing goes? Don't know, write my tests by hand. Hope that helps.