Hi there... back in 2019 I read somewhere that the clang devs and Microsoft were collaborating to make Visual Studio compatible with clang. IIRC the goal was to be able to use Visual Studio to build programs for both Windows and Linux. I tested Visual Studio with clang (on Windows) and I was hugely surprised at how well they work together!!
So what's the situation if I want to compile some C++ code for Linux? I realise that Windows-specific features won't be supported (e.g. MFC) but what about cross-platform code? Is there a Linux version of Visual Studio available now? Or does it work by cross-compiling from VS (in Windows) somehow? Hope that makes sense....
I don’t know anyone that is cross compiling from windows to linux using visual studio and clang right now. It doesn’t mean it can’t work, just that it’s not easy to point you at an example unfortunately.
Many thanks guys, A few months ago I asked on the CodeGuru forum (which is how I found out about Visual Studio and Clang!!) But no-one seems to know if VS+Clang can be used together to produce Linux apps. I’m pretty sure VS can produce .NET apps for both Windows and Linux - but I’m guessing not regular C++ apps. Anyway… regarding Paul and Aaron - are they members of this mailing list by any chance? If not - where could I find Discord? I’ve just tried a few Google searches for Clang and Discord but they all come up as Error 404 Thanks again - John
I don't know anyone that is cross compiling from windows to linux using visual studio and clang right now. It doesn't mean it can't work, just that it's not easy to point you at an example unfortunately.
+Robinson, Paul as someone that might know others that are.
+Aaron Ballman also.
You can also try asking on either irc or discord and see if anyone there can help.
Unfortunately, I don't have any experience in this area and I don't
know anyone who's tried that. It seems like it should be plausible,
but you may be breaking new ground.
I did a bit more digging and AFAICT Visual Studio does support WSL (like Harry said earlier) :-
It seems to be a way to install Linux so that it can be launched in Windows10 - and the Linux distro of your choice will then run in a virtual machine - BUT - if I'm reading things correctly, Visual Studio can then interact with WSL. So in effect, you can run Visual Studio (in Windows 10) but make it compile apps that'll then run under Linux.
The only minor drawback is that although Visual Studio is supported, Visual C++ itself isn't. So I'd need to install an alternative compiler called Clang. In fact there's even a hint that gcc is also supported.!
From: Aaron Ballman <aaron@aaronballman.com>
Sent: Saturday, August 8, 2020 8:48 AM
To: Eric Christopher <echristo@gmail.com>
Cc: John Emmas <john@creativepost.co.uk>; Robinson, Paul
<paul.robinson@sony.com>; via cfe-users <cfe-users@lists.llvm.org>
Subject: Re: [cfe-users] Compiling for Linux (with Visual Studio and
Clang)
>
> I don't know anyone that is cross compiling from windows to linux using
visual studio and clang right now. It doesn't mean it can't work, just
that it's not easy to point you at an example unfortunately.
>
> +Robinson, Paul as someone that might know others that are.
> +Aaron Ballman also.
>
> You can also try asking on either irc or discord and see if anyone there
can help.
Unfortunately, I don't have any experience in this area and I don't
know anyone who's tried that. It seems like it should be plausible,
but you may be breaking new ground.
~Aaron
There is, or was, an open-source plugin to drive Clang from VS in native
mode; if that still exists it might be a decent starting point.
The Sony toolkit for PS4 uses Visual Studio to drive clang, a proprietary
linker, and proprietary debugger for cross-building and debugging. Also
some other tools IIRC. We use a VS plugin to make this all work smoothly,
although I don't know any details about it. This is to say it's all
possible, although like everyone else I'm not aware of any worked example
targeting Linux.
--paulr
Thanks Paul - I found some instructions for installing WSL and Linux here:-
and I've managed to get it all installed without any problems - but I can't seem to run it
Basically... it needs me to use Windows PowerShell to enable something called the 'Virtual Machine Platform' (that bit worked okay). But then I need to enable Virtualisation which can only be done from within a machine's BIOS. Unfortunately, although I'm running Windows 10, I'm actually running it on Mac hardware (i.e. via dual-booting). And Macs don't allow access to the BIOS - not even when running Windows...
So it looks like I've hit a brick wall - unless I can find some way to enable Virtualisation without needing to do it via the BIOS.