這可能看起來像一個'noob'問題:我已經爲Mac下載了SFML-1.6,並且已將框架放入我的/ Library/Frameworks文件夾中。在嘗試編譯示例SFML應用程序後,我幾乎每次打電話給SFML都會收到鏈接程序錯誤。我不確定我錯過了什麼?我沒有太多的OSX和框架經驗,所以也許我需要通過其他方法鏈接到庫?OS X上的鏈接錯誤
輸出,如果它可以幫助:
Undefined symbols for architecture x86_64:
"sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)", referenced from:
osx_init::init() in osx_init.o
"sf::RenderWindow::RenderWindow(sf::VideoMode, std::string const&, unsigned long, sf::WindowSettings const&)", referenced from:
osx_init::init() in osx_init.o
"sf::RenderTarget::PreserveOpenGLStates(bool)", referenced from:
osx_init::init() in osx_init.o
"sf::Image::Image()", referenced from:
osx_init::init() in osx_init.o
"sf::Image::LoadFromFile(std::string const&)", referenced from:
osx_init::init() in osx_init.o
"sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)", referenced from:
osx_init::init() in osx_init.o
"sf::Sprite::Sprite(sf::Image const&, sf::Vector2<float> const&, sf::Vector2<float> const&, float, sf::Color const&)", referenced from:
osx_init::init() in osx_init.o
"sf::Image::GetWidth() const", referenced from:
osx_init::init() in osx_init.o
"sf::Image::GetHeight() const", referenced from:
osx_init::init() in osx_init.o
"sf::Image::GetPixelsPtr() const", referenced from:
osx_init::init() in osx_init.o
"sf::Image::~Image()", referenced from:
osx_init::init() in osx_init.o
"sf::Clock::Clock()", referenced from:
osx_init::init() in osx_init.o
"sf::Window::IsOpened() const", referenced from:
osx_init::init() in osx_init.o
"sf::Window::GetEvent(sf::Event&)", referenced from:
osx_init::init() in osx_init.o
"sf::Window::Close()", referenced from:
osx_init::init() in osx_init.o
"sf::Clock::GetElapsedTime() const", referenced from:
osx_init::init() in osx_init.o
"sf::Unicode::Text::Text(char const*)", referenced from:
osx_init::init() in osx_init.o
"sf::Font::GetDefaultFont()", referenced from:
osx_init::init() in osx_init.o
"sf::String::String(sf::Unicode::Text const&, sf::Font const&, float)", referenced from:
osx_init::init() in osx_init.o
"sf::Drawable::SetPosition(float, float)", referenced from:
osx_init::init() in osx_init.o
"sf::Drawable::SetColor(sf::Color const&)", referenced from:
osx_init::init() in osx_init.o
"sf::Window::Display()", referenced from:
osx_init::init() in osx_init.o
"sf::RenderWindow::~RenderWindow()", referenced from:
osx_init::init() in osx_init.o
"vtable for sf::Sprite", referenced from:
sf::Sprite::~Sprite() in osx_init.o
"sf::Drawable::~Drawable()", referenced from:
sf::Sprite::~Sprite() in osx_init.o
sf::String::~String() in osx_init.o
"vtable for sf::String", referenced from:
sf::String::~String() in osx_init.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
不,'-framework SFML'沒用。這是一個只包含頭文件的虛擬框架。如果你安裝了dylib,你可能還在'/ usr/local /'中安裝了頭文件,所以你不需要這個額外的框架。 – Hiura 2014-05-28 17:22:10