SFML community forums

Help => Window => Topic started by: Juanxo on June 20, 2010, 09:37:35 am

Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Juanxo on June 20, 2010, 09:37:35 am
hey all:

first sorry if this bug has been already reported.

while i was compiling one project with sfml 1.6, i get an error about some constant value in WindowStyle.hpp.

Searching the web, i have found this link that complains about the same situation: gamedev (http://www.gamedev.net/community/forums/topic.asp?topic_id=513501)

Some quick fix to repair it?
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Laurent on June 20, 2010, 10:09:37 am
The only quick fix that you can do is making sure that you never include XLib headers before SFML ones.
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Juanxo on June 20, 2010, 10:21:22 am
thx Laurent.

I only use sfml and Assimp, so perhaps some sfml files include Xlib headers?

EDIT: i have seen that cmake includes xlib before sfml. I have to find a way to change this.

Thanks
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Laurent on June 20, 2010, 10:34:24 am
SFML include Xlib internally, it doesn't produce any conflict in user code.

Quote
i have seen that cmake includes xlib before sfml. I have to find a way to change this.

What do you mean? What's the relation with CMake?
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Juanxo on June 20, 2010, 10:56:46 am
i'm using cmake to create my project makefile and it seems that the makefile created by cmake includes xlib before sfml
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Laurent on June 20, 2010, 01:09:57 pm
The makefile doesn't include anything, it's in your code that you have to find and swap the guilty #include statements.
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Juanxo on June 21, 2010, 01:05:49 am
cmake generates automatically makefiles for projects, and it seems to include xlib in linux. I don't include xlib in my code directly, causes i'm trying to programm cross-platform code.

I have the same code and the same cmakelists for windows and linux and i don't get any error in windows
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Laurent on June 21, 2010, 08:16:08 am
But makefiles don't include headers ;)

If XLib.h gets included, it's because somehere in your headers (or most likely in one of the external headers that you include) there is a #include <XLib.h>.

Sometimes its burried deeply inside headers, so it may be hard to figure out which header leads to #include <XLib.h>. A simple solution is to always include SFML (and headers that include SFML) first.

You don't get any error on Windows because XLib is a Linux library.
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Juanxo on June 23, 2010, 11:42:49 am
thx Laurent

I have found where "I" include it. it seems GLee uses Xlib.
Now the problem is that i cant include it before SFML, but SFML includes Opengl, and GLee need to be included before OpenGL.

This is crazy, man
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Laurent on June 23, 2010, 11:59:01 am
Quote
This is crazy, man

I agree. Defining None with a macro is definitely a disaster... Especially in such a common system header.

However I think there is another solution: #undef None after including Glee.h.
Title: Problem with anonymous enum in WindowStyle (Ubuntu)
Post by: Juanxo on June 24, 2010, 08:59:34 am
thx Laurent.