GCC 5.1 on OpenSUSE Tumbleweed

libolt

15-08-2015 05:51:31

I am having a problem building my game with MyGUI from latest git on an OpenSUSE Tumbleweed system with GCC 5.1. MyGUI itself builds and installs fine, however when I go to build my game I get the following errors related to MyGUI headers:


In file included from /usr/include/X11/Xlib.h:44:0,
from /usr/include/SDL2/SDL_syswm.h:70,
from /home/libolt/Projects/ubc-qtcreator/include/renderengine.h:55,
from /home/libolt/Projects/ubc-qtcreator/src/game/renderengine.cpp:27:
/usr/local/include/MYGUI/MyGUI_MouseButton.h:19:4: error: expected identifier before numeric constant
None = -1,
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h:19:4: error: expected ‘}’ before numeric constant
/usr/local/include/MYGUI/MyGUI_MouseButton.h:19:4: error: expected unqualified-id before numeric constant
In file included from /usr/local/include/MYGUI/MyGUI_WidgetInput.h:14:0,
from /usr/local/include/MYGUI/MyGUI_Widget.h:14,
from /usr/local/include/MYGUI/MyGUI_Gui.h:15,
from /usr/local/include/MYGUI/MyGUI.h:10,
from /home/libolt/Projects/ubc-qtcreator/include/gui.h:30,
from /home/libolt/Projects/ubc-qtcreator/src/game/renderengine.cpp:30:
/usr/local/include/MYGUI/MyGUI_MouseButton.h:36:20: error: expected ‘)’ before ‘_value’
MouseButton(Enum _value = None) :
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h:41:3: error: ‘friend’ used outside of class
friend bool operator == (MouseButton const& a, MouseButton const& b)
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h: In function ‘bool MyGUI::operator==(const MyGUI::MouseButton&, const MyGUI::MouseButton&)’:
/usr/local/include/MYGUI/MyGUI_MouseButton.h:43:13: error: ‘const struct MyGUI::MouseButton’ has no member named ‘mValue’
return a.mValue == b.mValue;
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h:43:25: error: ‘const struct MyGUI::MouseButton’ has no member named ‘mValue’
return a.mValue == b.mValue;
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h: At global scope:
/usr/local/include/MYGUI/MyGUI_MouseButton.h:46:3: error: ‘friend’ used outside of class
friend bool operator != (MouseButton const& a, MouseButton const& b)
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h: In function ‘bool MyGUI::operator!=(const MyGUI::MouseButton&, const MyGUI::MouseButton&)’:
/usr/local/include/MYGUI/MyGUI_MouseButton.h:48:13: error: ‘const struct MyGUI::MouseButton’ has no member named ‘mValue’
return a.mValue != b.mValue;
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h:48:25: error: ‘const struct MyGUI::MouseButton’ has no member named ‘mValue’
return a.mValue != b.mValue;
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h: At global scope:
/usr/local/include/MYGUI/MyGUI_MouseButton.h:51:18: error: non-member function ‘int MyGUI::getValue()’ cannot have cv-qualifier
int getValue() const
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h: In function ‘int MyGUI::getValue()’:
/usr/local/include/MYGUI/MyGUI_MouseButton.h:53:11: error: ‘mValue’ was not declared in this scope
return mValue;
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h: At global scope:
/usr/local/include/MYGUI/MyGUI_MouseButton.h:56:2: error: expected unqualified-id before ‘private’
private:
^
/usr/local/include/MYGUI/MyGUI_MouseButton.h:60:1: error: expected declaration before ‘}’ token
} // namespace MyGUI
^
CMakeFiles/ubc.dir/build.make:758: recipe for target 'CMakeFiles/ubc.dir/src/game/renderengine.cpp.o' failed
make[2]: *** [CMakeFiles/ubc.dir/src/game/renderengine.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ubc.dir/all' failed
make[1]: *** [CMakeFiles/ubc.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2


I wiped out all traces of mygui on my system, did a fresh git checkout and everything before building. The same git revisions of MyGUI and my game project work fine on windows/MSVC2013, windows/mingw-w64 gcc 4.9.2 and android gcc 4.6. I have no problems building on these platforms. I am guessing something has changed in GCC 5.1 since it is a major revision. Any help is greatly appreciated.

Altren

15-08-2015 13:58:04

I guess, that some other header define "None" to something. Try using #undef None before including MyGUI headers or in MyGUI_MouseButton.h

scrawl

15-08-2015 21:20:06

If I recall correctly, the None define is coming somewhere from X11 headers. SDL_syswm.h implicitely includes X11.

It shouldn't be difficult to restructure your code so that X11 and MyGUI aren't included in the same module.

libolt

15-08-2015 23:27:19

Okay the undef trick work, except that I had to undef all of the Button definitions in my code as well. As far as not mixing MyGUI and X11 related headers, is that going to be a problem since I use SDL to create my window and pass the window handle to Ogre? I do this so that I can use SDL for input.

edit: I forgot to mention that I am now getting a crash trying to run my game now that it links successfully:


Load ini file 'MyGUI_GeneratedFonts.xml'
terminate called after throwing an instance of 'Ogre::ItemIdentityException'
what(): OGRE EXCEPTION(5:ItemIdentityException): Can not find codec for 'png' image format.
There are no formats supported (no codecs registered). in Codec::getCodec at /home/libolt/builds/ogre-build/ogre-1.10/OgreMain/src/OgreCodec.cpp (line 69)
Aborted



The odd thing is that I know FreeImage has png support as it lists it in my Ogre.log and I have never had this error before on this machine.

Thanks