Name of gl/gl.h in mingw



I'm cross compiling JUCE with mingw on Linux, and needed to apply this patch:

diff --git a/modules/juce_opengl/juce_opengl.h b/modules/juce_opengl/juce_opengl.h
index 5c627ae..43768fd 100644
--- a/modules/juce_opengl/juce_opengl.h
+++ b/modules/juce_opengl/juce_opengl.h
@@ -34,7 +34,7 @@
  #define JUCE_OPENGL_ES 1
  #ifndef APIENTRY
   #define APIENTRY __stdcall
@@ -52,6 +52,8 @@
   #undef APIENTRY
+ #include <GL/gl.h>
  #include <GL/gl.h>
  #undef KeyPress


I couldn't find any issue about this in the forum though, so maybe it's usually the other way around (i.e "/GL/gl.h" instead of "gl/GL.h" on mingw)?



Oh, I guess both mingw/windows and the microsoft c compiler are case insensitive? In that case, maybe the simple patch below would be correct. Because mingw is not case insensitive when cross compiling on linux.

diff --git a/modules/juce_opengl/juce_opengl.h b/modules/juce_opengl/juce_opengl.h
index 5c627ae..b719659 100644
--- a/modules/juce_opengl/juce_opengl.h
+++ b/modules/juce_opengl/juce_opengl.h
@@ -43,7 +43,7 @@
   #define WINGDIAPI __declspec(dllimport)
- #include <gl/GL.h>
+ #include <GL/gl.h>
   #undef WINGDIAPI


I don't think I ever built juce opengl stuff with mingw, but for regular usage this is what I have:

#include "GL/gl.h"

I know that one works.


Yes, that's the one I have always seen in Linux. But maybe, for some reason, it's "gl/GL.h" in Windows.


Anyway, I was compiling the plugin audio host to check if it would crash when opening the GUI of a plugin there. It did not crash in the "audio plugin host", and I finally found out that this block of code:


     this->setSize (400, 300);

      this->setContentOwned(editor, true);
      if (data->x <= 0 || data->y <= 0) {
        this->centreWithSize (getWidth(), getHeight());
      } else {
        this->setTopLeftPosition(data->x, data->y);



...had to be run inside the constructor of the PluginWindow class, and not after the constructor function was finished. I think that is really weird... The host will crash if you run the above code after the constructor has finished and try to show the GUI of a VST plugin that shows a popup window first. The demo version of the "OhmBoyz" plugin does this, and also the SampleTank3 pluginafter the try-out duration is finished.

Hmm, but I'm not able to reproduce the crash in the JUCE "audio plugin host" example program though (although it is 100% reproducable in my program). In my program, maybe it has something to do with using Qt, JUCE and running an additional OpenGL thread at the same time. I still don't grasp why it makes a difference to run that code inside the constructor though.


The official MS Windows SDK really does use gl/GL.h, but usually on Windows this doesn't really matter as filenames are case-insensitive.

Can you guys confirm that if I change the current line

 #include <gl/GL.h>


  #include <GL/gl.h>
  #include <gl/GL.h>

..then that'll make everyone happy?

I can confirm that the master branch of git (i.e. 4.2.4) cross-compiles on Linux using mingw gcc 5.4.0 (from mxe). So all seems good now. Thank you.