MinGW report

Just a report that I have built JUCE using gcc tdm 4.4.0 under MinGW environment using external libraries (zlib, png, jpeg, ogg, flac)…

I don’t know official state of support for MinGW, but here is the diff of amalgamated file:

--- /F/msys/svn/juce/juce_amalgamated.cpp	2009-06-29 14:39:56 +0200
+++ juce_amalgamated.cpp	2009-07-03 15:38:37 +0200
@@ -627,8 +627,12 @@
     HRESULT CoCreateInstance (REFCLSID rclsid, DWORD dwClsContext)
+#ifndef __MINGW32__
         operator= (0);
         return ::CoCreateInstance (rclsid, 0, dwClsContext, __uuidof(T), (void**) &p);
+	return S_FALSE;
     T* p;
@@ -215037,6 +215041,7 @@
 using namespace jpeglibNamespace;
+using jpeglibNamespace::boolean;
 struct JPEGDecodingFailure {};


Ok, thanks for that.

I’m happy to add the “using jpeglibNamespace::boolean;” bit, but am surprised that CoCreateInstance doesn’t work… Surely the mingw libraries include that function?

It’s not CoCreateInstance, it is __uuidof() operator

Visual C++ Language Reference
__uuidof Operator

Microsoft Specific

Retrieves the GUID attached to the expression.

Ah, I see. Ok, thanks.


You added:

#if ! JUCE_WIN32
 using jpeglibNamespace::boolean;

This doesn’t work for MinGW:
JUCE_WIN32 is defined for MinGW


So I guess it’d need to be




I’m finding more problems than this to build a win executable with qt-creator and gcc4.4 from mingw on a windows machine.
Here are the problems:

  1. <crtdbg.h> and <comutls.h> are not present in mingw include files (including MSVC ones don’t work).

#if JUCE_WIN32
#ifndef GNUC
#include <crtdbg.h>
#include <comutls.h>

  1. alloca isn’t defined (used in EdgeTable)… something like this would do

#if JUCE_WIN32
#if defined GNUC
#define alloca __builtin_alloca

  1. the WM_APPCOMMAND message isn’t defined in mingw headers. add something like this:

#define WM_APPCOMMAND 0x0319

i will post more as i advance on this.

any advance in this topic??


Can’t remember - this is over a year ago! Try the tip.

From the tip… this should read:

	static juce_wchar* doubleToString (juce_wchar* buffer, int numChars, double n, int numDecPlaces, size_t& len) throw()
		if (numDecPlaces > 0 && n > -1.0e20 && n < 1.0e20)
			juce_wchar* const end = buffer + numChars;
			juce_wchar* t = end;
			int64 v = (int64) (pow (10.0, numDecPlaces) * std::abs (n) + 0.5);
			*--t = (juce_wchar) 0;

			while (numDecPlaces >= 0 || v > 0)
				if (numDecPlaces == 0)
					*--t = getDecimalPoint();

				*--t = (juce_wchar) ('0' + (v % 10));

				v /= 10;

			if (n < 0)
				*--t = '-';

			len = end - t - 1;
			return t;
  #if (JUCE_MSVC && _MSC_VER <= 1400) || JUCE_MINGW
			len = _snwprintf (buffer, numChars, L"%.9g", n);
			len = _snwprintf_s (buffer, numChars, _TRUNCATE, L"%.9g", n);
			len = swprintf (buffer, numChars, L"%.9g", n);
			return buffer;

a small fix in the ifdefs allowing MINGW to compile here.

Ok, thanks!