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

Author Topic: Another Xcode SFML2 newbie question  (Read 1707 times)

0 Members and 2 Guests are viewing this topic.

msteele

  • Newbie
  • *
  • Posts: 12
    • View Profile
Another Xcode SFML2 newbie question
« on: July 22, 2011, 10:31:35 am »
I have an old project I would like to resurrect and convert into an Xcode project. This project compiles successfully using sfml2 successfully like so:
Code: [Select]
gcc -Wall -lsfml-system -lsfml-window -framework GLUT -framework OpenGL src/*.cpp -o Executable

I followed http://www.sfml-dev.org/forum/viewtopic.php?p=23677#23677.
However, in Xcode I get an error:
Quote
'ContextSettings' is not a member of 'sf'


This bit of code from which this error originates:
Code: [Select]
sf::VideoMode DesktopMode = sf::VideoMode::GetDesktopMode();
sf::ContextSettings OGLContext(
24, // depth
8, // stencil
4, // antialiasing
2, // major
0); // minor
WIDTH = DesktopMode.Width;
HEIGHT = DesktopMode.Height;
ASPECT = float(WIDTH)/float(HEIGHT);
Window.Create(DesktopMode, "FlightGame", sf::Style::Fullscreen, OGLContext);
Window.SetActive();

Note that this is the first error, so apparently VideoMode is a member. This makes it seem like some sort of SFML1.6 has snuck in.

I have forgotten most of my C++ specific knowledge so debugging this is proving difficult. I really appreciate any help.

Thanks
- Miles

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Another Xcode SFML2 newbie question
« Reply #1 on: July 22, 2011, 10:36:49 am »
Quote
This makes it seem like some sort of SFML1.6 has snuck in.

Indeed. So check your project settings and make sure that it points to SFML 2 ;)
Laurent Gomila - SFML developer

msteele

  • Newbie
  • *
  • Posts: 12
    • View Profile
Another Xcode SFML2 newbie question
« Reply #2 on: July 22, 2011, 10:48:32 am »
Quote from: "Laurent"
Quote
This makes it seem like some sort of SFML1.6 has snuck in.

Indeed. So check your project settings and make sure that it points to SFML 2 ;)

Well, the only things I've told the project are to include libsfml-system and window .dylibs. They indicate that they point to /usr/local/lib/libsfml-system.2.0.0.dylib and /usr/local/lib/libsfml-window.2.0.0.dylib. So that seems right.

Is there something wrong with my includes? (that would make them behave differently in gcc vs xcode)
 
Code: [Select]
#include <SFML/System.hpp>
#include <SFML/Window.hpp>

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Another Xcode SFML2 newbie question
« Reply #3 on: July 22, 2011, 10:57:55 am »
You must also tell the project where to find the SFML 2 headers.

It seems like you installed both SFML 1.6 and SFML 2 to standard paths (resp. /usr/include and /usr/local/include?). So maybe the best thing to do is to completely remove all the SFML 1.6 files that you previously installed.

I'm not the Mac OS expert of the team so maybe there are simpler solutions (with frameworks?).
Laurent Gomila - SFML developer

msteele

  • Newbie
  • *
  • Posts: 12
    • View Profile
Another Xcode SFML2 newbie question
« Reply #4 on: July 22, 2011, 11:22:19 am »
Yay! You were right. It was picking up the includes in the old SFML framework. I zipped that up for good measure and then added /usr/local/include to "Header Search Paths". Now it compiles and even runs.

Thanks so much :)