Reputation: 43
I am trying to compile a simpel code that will show me a window by using Xcode with my mac. Everything seems to work and I get "Build Succeeded". But then nothing happens and I get the message:
dyld: Library not loaded: @rpath/libsfml-audio.2.4.dylib
Referenced from: /Users/zeeshanaslam/Library/Developer/Xcode/DerivedData/test-frpvsmylufuctqaphblszdoivflt/Build/Products/Debug/test
Reason: image not found
I am very new to programming, so please could any one help me with this problem.
My code is:
#include <SFML/Graphics.hpp>
int main(){
sf::RenderWindow window(sf::VideoMode(640,480),"TEST");
while (window.isOpen()){
sf::Event evnt;
while (window.pollEvent(evnt)){
if(evnt.type == evnt.Closed)
window.close();
}
window.clear();
window.display();
}
}
I am not sure if its the code or Xcode is what causing the problem.
Upvotes: 4
Views: 2407
Reputation: 494
I managed to run this code completely fine (OS X 10.11.6, Xcode 8.2.1). Here were my steps to getting it to run:
brew install sfml
in the terminal./usr/local/sfml/cellar/sfml/2.4.2/include
to my header search path in xcode./usr/local/sfml/cellar/sfml/2.4.2/lib
, I dragged the audio, graphics, network, system and window dylibs into xcode. This is sufficient for xcode to link (and run) your code.Upvotes: 1