SFML community forums

Help => General => Topic started by: SoroGin on February 13, 2015, 01:33:09 am

Title: SFML 2.2 Sample Code Not Working With Xcode 6.1.1 [SOLVED]
Post by: SoroGin 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;
}
 
Title: Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
Post by: Hiura on February 13, 2015, 08:34:52 am
You most probably have some old binaries lurking around. Find and trash them.
Title: Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
Post by: SoroGin 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.
Title: Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
Post by: Hiura on February 13, 2015, 10:58:03 am
No, I'm talking about old SFML versions.
Title: Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
Post by: SoroGin 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?
Title: Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
Post by: Hiura on February 13, 2015, 12:40:10 pm
Maybe, look into /usr/local as described in the tutorial.
Title: Re: SFML 2.2 Sample Code Not Working With Xcode 6.1.1
Post by: SoroGin 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.