🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Visual Studio target WSL

Started by
6 comments, last by LorenzoGatti 3 years, 11 months ago

Hi

Currently I only have Ubuntu installed in WSL and try to compile my Windows/VS/C++ project for WSL. Stuck at:

1>main.cpp

1>C:\Users\Michael\Desktop\CPP\myproject\main.cpp(19,10): error : GL/gl.h: No such file or directory

1>myList.cpp

1>C:\Users\Michael\Desktop\CPP\myprject\myList.cpp(5,10): error : XPLMUtilities.h: No such file or directory

xplmutilites is found in main.cpp. How to add wsl include etc. folders? When shall we see WSL Desktop support, this fall?

Many thanks

Michael

Advertisement

Did you install the appropriate Visual Studio feature?

Did you configure include directories in your project?

Why are you trying to compile a Linux executable with Visual Studio anyway, instead of using non-experimental compilers like gcc or clang from your Ubuntu WSL or from a Docker container?

Regarding “desktop” support, you can already run a X server from Windows. What are you missing?

Omae Wa Mou Shindeiru

My project uses libcurl, opengl and freetype. Now as I currently don't dual boot it might be easiest to use visual studio Linux support?

My include/libs VS Linux doesn't yet have above as I was hoping to link somehow to the installed Ubuntu on wsl? Never used docker. As for X on Windows, I only watched a video but seems complicated and without accelerated opengl. Best to wait?

So is it possble to include/lib those above? I also have a spare usb HD, should I bother to install Ubuntu on that?

Thanks

Found out that I can access \\wsl$\Ubuntu\usr\include but VS still says to not find the headers after adding that folder.

If you try to include files ftom \\wsl$\anywhere you are probably misunderstanding how Visual Studio's “Linux Development with C++” feature works.

The official documentation makes it clear that it doesn't actually use the Visual Studio compiler, but rather gcc on a “remote” Linux system via CMake: you can use WSL as the target, but

  • you need gcc, ninja, gdb, possibly CMake installed in your WSL Ubuntu, which you could use directly instead
  • you must not access files from WSL directly to avoid corruption
  • you probably want a Windows build of your project anyway
  • OpenGL in a headless WSL environment isn't going to work well (or at all)

So, is using a remote debugger (Visual Studio → WSL) worth the setup effort and the flakiness compared to using CMake, Meson or other portable build systems directly? Don't you want a Windows version of your project, which you could develop in Visual Studio's “comfort zone” without troublesome perversions and with reasonable assurance of being able to compile a Linux version when the need arises?

Omae Wa Mou Shindeiru

Of course my project compiles with VS on Win10. I don't want remote as I've a local WSL. So again anyone can help setting up the includes and libs? Thanks.

If you aren't interested in setting up a proper Linux development environment at the moment, develop your project for Windows only, ignore WSL, and you should be able to create an adequate build script for Linux (a proper machine, not WSL) later if you don't go out of your way to do something nonportable.

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement