title: WSL Ubuntu showing "Error: Unable to open display" even after manually setting display environment variable
body: <p>I'm using g++ on WSL Ubuntu. I cloned the GLFW repo using git, used the <code>ccmake</code> command to configure and generate the binaries, then used <code>make</code> inside the &quot;build&quot; directory to finally create the <code>.a</code> file. I installed all the OpenGL-related libraries to <code>/usr/ld</code> (I don't recall exactly which I installed, since I had to install so many. Regardless, the g++ command works, so I assume it was a success). Afterwards, I made a project on VS Code that looks like this:</p>
  <p><a href="https://i.stack.imgur.com/TfoZq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TfoZq.png" alt="enter image description here" /></a></p>
  <p>The GLFW include-folder is from the aforementioned cloned repo, and the GLAD and KHR include-folders are from <a href="http://glad.dav1d.de" rel="nofollow noreferrer">glad.dav1d.de</a>, where I set the GL version (under API) to <em>3.3</em>, and the Profile to <em>Core</em>.</p>
  <p>In <code>main.cpp</code>, I put a simple snippet of code meant to initialize GLFW:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;glad/glad.h&gt;
  #include &lt;GLFW/glfw3.h&gt;
  
  int main()
  {
      // Initialize GLFW
      if (!glfwInit()) {
          std::cerr &lt;&lt; &quot;Failed to initialize GLFW&quot; &lt;&lt; std::endl;
          return 1;
      }
      glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
      glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
      glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  
      std::cout &lt;&lt; &quot;Success&quot; &lt;&lt; std::endl;
  
      return 0;
  }
  </code></pre>
  <p>Then used this to command to compile the project: <code>g++ -Wall -I./include/ -L./lib/ src/*.{c,cpp} -lglfw3 -lGL -lX11 -lpthread -lXrandr -lXi -ldl -o main</code>. There were no warnings or errors or anything. After running the executable, I get the error message that GLFW failed to initialize. I was a little confused why this happened, so I typed the <code>glxinfo</code> command to find out that my <code>DISPLAY</code> environment variable hasn't been set.</p>
  <p>I have absolutely no idea what this variable is, or what it's meant to represent. After scouring around on the internet, I came across <code>export DISPLAY=:0.0</code> and <code>export DISPLAY=1</code> and <code>export DISPLAY=IP:0.0</code>, none of which worked. Any ideas on how I could resolve this?</p>