C++ xcode SFML dyld: Library not loaded: @rpath/libsfml-audio.2.5.dylib

  • chihsinh
    Likes 0

    Problem Description

    I installed SFML following instructions from this video: https://www.youtube.com/watch?v=TmDrSTSowKI&feature=share&fbclid=IwAR11JTGi-u6J4SXFS8YNA5GP1myyqRFKyDtR5I6hwceyX9JcKShfaxGfpr8.

    When I tried the example code, build succeeded, but it couldn’t open a window.

    The code:

    #include <SFML/Graphics.hpp>
    #include <iostream>
    
    #define SCREEN_WIDTH 1024
    #define SCREEN_HEIGHT 1024
    
    int main()
    {
        sf::RenderWindow window( sf::VideoMode( SCREEN_WIDTH, SCREEN_HEIGHT), "Awesome Game");
        while (window.isOpen())
        {
            //handle input/events
            sf::Event event;
            
            while (window.pollEvent(event))
            {
                switch(event.type)
                {
                    case sf::Event::Closed:window.close();
                        
                        break;
                }
            }
            
            //update game logic
            
            window.clear();
            
            //draw objects
            
            window.display();
        }
        
        return EXIT_SUCCESS;
    }

    This was the error shown: 

    dyld: Library not loaded: @rpath/libsfml-audio.2.5.dylib

      Referenced from: /Users/chihsin1/Library/Developer/Xcode/DerivedData/sfml_test-gpewsagihndgmmdtywtasqeihiov/Build/Products/Debug/sfml test

      Reason: image not found

     

  • Sonar Systems admin
    Likes 0

    Have you tried everything from GitHub?

Login to reply