X11 Linux Errors

Mr.Hankey

07-12-2008 18:41:27

Hi,

I grabbed the latest MyGUI version from SVN and Iget some strange compile errors when I include MyGui.h after Xlib.h

This works

#include "MyGUI.h"
#include <X11/Xlib.h>


...this doesn't

#include <X11/Xlib.h>
#include "MyGUI.h"


Error is:

/external-libs/mygui/include/MyGUI_Message.h:27: Fehler: expected identifier before numeric constant
r/external-libs/mygui/include/MyGUI_Message.h:27: Fehler: expected `}' before numeric constant
/external-libs/mygui/include/MyGUI_Message.h:27: Fehler: expected unqualified-id before numeric constant
/external-libs/mygui/include/MyGUI_Message.h:69: Fehler: expected unqualified-id before »public«
/external-libs/mygui/include/MyGUI_Message.h:74: Fehler: »ViewInfo« in Klasse »MyGUI::Message« bezeichnet keinen Typen
...


my system is Ubuntu 8.04...
Any help would be greatly appreciated :)

Altren

07-12-2008 20:29:39

Show your 27, 69 and 74 lines.

I think X11 define some names that we use in normal way.

my.name

08-12-2008 01:32:29


enum ViewValueInfo
{
None = MYGUI_FLAG_NONE,
...
...
};



find
#define None
in X11

test

#include <X11/Xlib.h>
#undef None
#include "MyGUI.h"

Mr.Hankey

08-12-2008 16:11:20

ok that works for None = MYGUI_FLAG_NONE
but now I get the same error for Button1 = MYGUI_FLAG(9)


/external-libs/mygui/include/MyGUI_Message.h:38: Fehler: expected identifier before numeric constant
/external-libs/mygui/include/MyGUI_Message.h:38: Fehler: expected `}' before numeric constant
/external-libs/mygui/include/MyGUI_Message.h:38: Fehler: expected unqualified-id before numeric constant
/external-libs/mygui/include/MyGUI_Message.h:69: Fehler: expected unqualified-id before »public«


The only way I can get this to work is to do the following

#include <X11/Xlib.h>
#endif
#undef None
#undef Button1
#undef Button2
#undef Button3
#undef Button4
#include <MyGUI.h>


isn't there a better way to resolve those conflicts?

Altren

08-12-2008 17:27:47

Actually it's bad design of X11 headers. We can't #undef keywords in our code because someone else can define any word. And you always can write something like #define true false and we can't be saved from this.

So, just include MyGUI.h first.