CLion video device with WSL and SDL2
Hey,
I managed to run WSL toolchain (Nice by the way!)
But please note that this is the ONLY toolchain which would work with:
- Google Test (1.8.0) (compiling / running) for Unit Testing,
- offers Debugging,
- SDL2 (at least compiling) ,a graphics card API
I really need those 3 to run with one toolchain!
Here is an overview of the different toolchains and their weaknesses (I tried these combinations the whole day):
----------------------------------------------------------------------------------------------
Google Test | Debugging | SDL2.0.8
Cygwin: yes | yes | no
MinGW no | yes | yes
VS yes | no | yes
WSL yes | yes | yes
----------------------------------------------------------------------------------------------
But when trying to set up a simple SDL2 program (SDL_init(SDL_INIT_EVERYTHING), it throws an error saying "no available video device"
It seems like WSL would try to use a linux video device. (I'm using Ubuntu App for Windows 10).
Is there a possibility to use the windows video device instead? I'm not sure if Ubuntu App for windows would provide a video device. I'd only like to use WSL for compiling. I want to run it under Windows OS anyway.
SDL2 did work under MinGW (did find a video device). But as you can see MinGW on the other hand has some disadvantages listed above.
Thanks for any help in advance!
Please sign in to leave a comment.
Hello!
>I'd only like to use WSL for compiling. I want to run it under Windows OS anyway.
Do you mean that you want to run the resulted application on Windows? But using WSL means that a project will be built on WSL Ubuntu (in your case) and the resulted application also will run on WSL Ubuntu.
I'm not sure why MinGW has "no" for Google Test in your table. Installing the pre-compiled version of Google Test is not recommended. Preferable approach is compiling Google Test inside your project. You can do that using MinGW. Please see our web help article about Google Test.
Hey,
GoogleTest is currently not working with MinGW as it can be seen on the gitHub webpage (there are several issues and branches). It is supposed to be fixed with GoogleTest 1.8.1 (current version is GoogleTest 1.8). That's why I only can run this combination of libraries I need on Linux machine.
And yeah I understand the precompiled issue. But this happens with self-compiled Google Test 1.8 from downloaded source code. Just for you to know. And the master branch is currently not stable enough to use it.
Hey, did you manage to get this working in the end?
I am running into the same problem. An extra step that I also tried was configuring an X Server to run in Windows then forward the display info from WSL to that server. I used this one: https://token2shell.com/x410/.
I was successfully able to run xterm using this solution and I'm convinced it's what we need for SDL to run correctly in WSL, but I still get the same error as you so there's still something else missing.
Hey you :)
I did not manage to run SDL2 with WSL. And in my opinion there is no need to do that for various reasons, assuming your question is still SDL2 / Google Test related.
First: Google Test 1.8.1 is out now! So the MinGW bug is fixed. This means that SDL2 + Google Test 1.8.1 can be build using CLion, MinGW & CMake on Windows OS, which was NOT possible before.
Second: If you have a Windows machine and want to test / write your project on Linux OS as well (CLion is cross-platform) just create a virtual machine using VirtualBox with a Linux based OS. Inside this machine you can do anything you want. (Installing CLion, CMake, SDL2, Google Test) It's very easy!
Btw.: if you want to use SDL2 for game design / playing around a little you might be interested in my open source project:
https://lynarstudios.com/lynarenginemoon