CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: WSL (Windows Subsystem for Linux)

  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,607

    WSL (Windows Subsystem for Linux)

    Has anyone here tried WSL? AFAICT it's 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 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.

    But although Visual Studio's supported, Visual C++ itself can't do this (AFAICT). So you need to install an alternative compiler called Clang. There's even a hint that gcc is also supported.

    Just wondering if anyone here's ever tried it?
    "A problem well stated is a problem half solved. - Charles F. Kettering

  2. #2
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,257

    Re: WSL (Windows Subsystem for Linux)

    Sorry, no.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.7.3)

  3. #3
    Join Date
    Feb 2017
    Posts
    564

    Re: WSL (Windows Subsystem for Linux)

    Quote Originally Posted by John E View Post
    Just wondering if anyone here's ever tried it?
    I haven't but it's interesting. Is Windows becoming a Linux distribution? According to this info,

    https://docs.microsoft.com/en-us/win...mpare-versions

    version 2 of WSL has a full Linux kernel. I have completely missed the Microsoft love-affair with Linux. Strange new world indeed,

    http://www.linuxandubuntu.com/home/m...based-on-linux

    If you want to develop for Linux but want to stick with the maybe more familiar Windows environment I see no reason why you shouldn't try WSL 2. On the other hand, this kind of undertakings are always a hassle so one better brace for that.
    Last edited by wolle; August 9th, 2020 at 04:18 AM.

  4. #4
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,607

    Re: WSL (Windows Subsystem for Linux)

    Hi wolle - i'm investigating this at the moment but I must admit I'm getting the impression (possibly) that although it'll offer VS compilation for Linux, it's maybe limited to command line / BASH type apps. I haven't yet seen much evidence that it'll allow me to build full GUI apps - but maybe I just need to look a bit harder. Still a bit confused at the moment...
    "A problem well stated is a problem half solved. - Charles F. Kettering

  5. #5
    Join Date
    Feb 2017
    Posts
    564

    Re: WSL (Windows Subsystem for Linux)

    Quote Originally Posted by John E View Post
    I haven't yet seen much evidence that it'll allow me to build full GUI apps
    I found this info,

    https://www.theverge.com/2020/5/19/2...n-wsl-features

    so it seems possible to get a Linux GUI working on Windows with WSL 2 indeed.
    Last edited by wolle; August 9th, 2020 at 10:14 AM.

  6. #6
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,607

    Re: WSL (Windows Subsystem for Linux)

    Wow, that looks promising!

    The only issue I've had is that I'll need to install Linux (and only some distros are supported). But even the supported ones say they won't work "in S mode" - or that "Windows 10 S" isn't supported. Anyone know what the S means

    [Edit...] Ah - I just found it... apparently Windows 10 S will only run apps downloaded from the Windows Store.
    Last edited by John E; August 9th, 2020 at 11:32 AM.
    "A problem well stated is a problem half solved. - Charles F. Kettering

  7. #7
    Join Date
    Feb 2017
    Posts
    564

    Re: WSL (Windows Subsystem for Linux)

    Quote Originally Posted by John E View Post
    Wow, that looks promising!
    Yes but WSL 2 is very new and because of that a quite risky proposition.

    If the major reason for considering WSL is familiarity with the Microsoft development tools there's another strategy possible. That is to use a portable GUI subsystem such as Qt or wxWidgets. This would allow you to develop the application entirely on Windows using Visual Studio. During the development process the source code is then regularly transferred to a dedicated Linux computer and built there without modification for testing.

    Depending on the nature of your project this may be a safer approach considering the immature status of WSL at this point.

  8. #8
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,607

    Re: WSL (Windows Subsystem for Linux)

    I've hit a different hurdle...

    I got everything installed but it won't run. The reason is that although I'm running Win10, I'm running it on Mac hardware (i.e. dual booting). The WSL stuff requires Virtualisation to be enabled in the BIOS but it's currently disabled on my machine (bottom, right-hand corner):-

    Name:  TaskManager.jpg
Views: 32
Size:  48.1 KB

    Not a huge problem you'd think - except that Macs don't allow access to the BIOS... not even for Windows use

    So does anyone know of some utility that'll allow me to make BIOS changes - but without physically needing to enter the BIOS ??
    "A problem well stated is a problem half solved. - Charles F. Kettering

  9. #9
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,607

    Re: WSL (Windows Subsystem for Linux)

    After two weeks of tearing my hair out I've finally managed to make this work!! And just a few seconds ago I cross-compiled my first "Hello World" console app for Linux!!!

    The only thing that confuses me is that the finished app (which in Windows would be an exe) seems to have the extension ".out"

    I'm not aware of .out being a bona-fide Linux file extension - so I'm wondering now if the built files will genuinely run on regular Linux - or do they only run under WSL?
    "A problem well stated is a problem half solved. - Charles F. Kettering

  10. #10
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,257

    Re: WSL (Windows Subsystem for Linux)

    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.7.3)

  11. #11
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,607

    Re: WSL (Windows Subsystem for Linux)

    Ah, that explains it - thanks !
    "A problem well stated is a problem half solved. - Charles F. Kettering

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)