Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem with anonymous enum in WindowStyle (Ubuntu)  (Read 4783 times)

0 Members and 1 Guest are viewing this topic.

Juanxo

  • Newbie
  • *
  • Posts: 21
    • View Profile
Problem with anonymous enum in WindowStyle (Ubuntu)
« 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

Some quick fix to repair it?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #1 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.
Laurent Gomila - SFML developer

Juanxo

  • Newbie
  • *
  • Posts: 21
    • View Profile
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #2 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #3 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?
Laurent Gomila - SFML developer

Juanxo

  • Newbie
  • *
  • Posts: 21
    • View Profile
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #4 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #5 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.
Laurent Gomila - SFML developer

Juanxo

  • Newbie
  • *
  • Posts: 21
    • View Profile
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #6 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #7 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.
Laurent Gomila - SFML developer

Juanxo

  • Newbie
  • *
  • Posts: 21
    • View Profile
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #8 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #9 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.
Laurent Gomila - SFML developer

Juanxo

  • Newbie
  • *
  • Posts: 21
    • View Profile
Problem with anonymous enum in WindowStyle (Ubuntu)
« Reply #10 on: June 24, 2010, 08:59:34 am »
thx Laurent.

 

anything