Page 1 of 1

VLC 2.0.2 compiling on Windows XP with MingGW/MSYS

Posted: 03 Jul 2012 17:13
by SENCO
I have experienced the following problem when compiling VLC on Windows XP since 2.0.2 update.

When compiling Qt4 module, it stops on dialogs_provider.cpp, as it has an include file (dialogs/preferences.hpp) with the following line:

Code: Select all

QRadioButton *small,*all;
(line 72: private members section).

The problem is that dialogs_provider.cpp includes main_interface.hpp which, in turn, includes <vlc_windows_interfaces.h> which now includes <objbase.h> (from TDM compiler) which through rpcndr.h defines small as a char. So the preprocessor changes the above line into:

Code: Select all

QRadioButton *char,*all;
Such thing is invalid, as char is a reserved word, so the compilation fails with the folloging unmeaningful info:
In file included from dialogs_provider.cpp:42:0:
dialogs/preferences.hpp: At global scope:
dialogs/preferences.hpp:72:19: error: expected unqualified-id before 'char'
dialogs/preferences.hpp:72:18: error: expected ';' at end of member declaration
dialogs/preferences.hpp:72:24: error: expected unqualified-id before ',' token
...some deprecation warnings...
make[1]: *** [libqt4_plugin_la-dialogs_provider.lo] Error 1
make[1]: Leaving directory `/vlc/modules/gui/qt4'
make: *** [all] Error 2
There is an evident workaround, that is to rename small variable into a different name. But I want to post here to help anyone which could find the same problem. If someone modifies the source to fix this bug, please, let me know to keep it in sync in the future.

Regards,

Re: VLC 2.0.2 compiling on Windows XP with MingGW/MSYS

Posted: 03 Jul 2012 22:23
by Jean-Baptiste Kempf
This is a bug in your toolchain.

Re: VLC 2.0.2 compiling on Windows XP with MingGW/MSYS

Posted: 04 Jul 2012 16:53
by SENCO
I have checked the origin of this file, and rpcndr.h comes with w32api package of MinGW and TDM. Both compilers uses the same file, which was last edited on 2006. On line 50 we can find:

Code: Select all

#define small char
This line is also present in latest cygwin. You can see here:
http://cygwin.com/cgi-bin/cvsweb.cgi/sr ... h_tag=HEAD

I know that using defines for that is troublesome and the correct way is using a typedef, but the fact is that all mingw/cygwin uses this.
This problem arose after the inclusion of "<objbase.h>" in vlc_windows_interfaces.h. Up to know, i'm using the following workaround:

Code: Select all

#include <objbase.h> #undef small
And now everything compiles fine.