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

Author Topic: SFML 2.2 Sample Code Not Working With Xcode 6.1.1 [SOLVED]  (Read 2044 times)

0 Members and 2 Guests are viewing this topic.

SoroGin

  • Newbie
  • *
  • Posts: 4
    • View Profile
SFML 2.2 Sample Code Not Working With Xcode 6.1.1 [SOLVED]
« on: February 13, 2015, 01:33:09 am »
For some reason, I can't get the sample code to run correctly. Xcode stops with a bad access error on window.clear().

I've double-checked that I have the command line tools installed and corresponding SFML files are in the correct places.

Here is the code that I am trying to run:

#include <SFML/Graphics.hpp>

int main(int, char const**)
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

    // Start the game loop
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Close window: exit
            if (event.type == sf::Event::Closed) {
                window.close();
            }

            // Escape pressed: exit
            if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) {
                window.close();
            }
        }

        // Clear screen
        window.clear();

        // Update the window
        window.display();
    }

    return EXIT_SUCCESS;
}
 
« Last Edit: February 13, 2015, 01:26:49 pm by SoroGin »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
« Reply #1 on: February 13, 2015, 08:34:52 am »
You most probably have some old binaries lurking around. Find and trash them.
SFML / OS X developer

SoroGin

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
« Reply #2 on: February 13, 2015, 10:50:26 am »
By old binaries, I'm assuming you mean the project.app file that's output as a result of running in Xcode, right? I tried deleting and re-running, and it still doesn't work. I also tried running clean first and then running, if that would make a difference.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
« Reply #3 on: February 13, 2015, 10:58:03 am »
No, I'm talking about old SFML versions.
SFML / OS X developer

SoroGin

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
« Reply #4 on: February 13, 2015, 12:32:45 pm »
Oh, right, sorry.

I went back to /Library/Frameworks and deleted all the SFML related frameworks and re-copied all the SFML 2.2 ones, include the two external libraries, and it still doesn't work. Is there something I'm still neglecting to look at?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
« Reply #5 on: February 13, 2015, 12:40:10 pm »
Maybe, look into /usr/local as described in the tutorial.
SFML / OS X developer

SoroGin

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
« Reply #6 on: February 13, 2015, 01:26:29 pm »
Oh, yes, sorry. I removed the old SFML folder in /usr/local/include and replaced it with the new one and it works now. I suppose I've just been absentmindedly neglecting this particular part.

Thank you very much for your patience and help.