2011-12-17 15 views
5

Bu oldukça 'noob' sorusu gibi görünebilir: Mac için SFML-1.6'yı indirdim ve çerçevelerimi/Library/Frameworks klasörüne yerleştirdim. Bir örnek SFML uygulamasını derledikten sonra SFML'ye yaptığım her çağrı için bağlayıcı hatalarım var. Ne eksik olduğumdan emin değilim? OSX ve Frameworks'le çok fazla tecrübem yok, bu yüzden belki de kütüphanelere başka bir yöntemle bağlanmam gerekiyor mu?OS X'deki Linker Hataları

Çıktı, eğer yardımcı olur:

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) 

cevap

2

senin problemin de OS X üzerinde bir deneyimli geliştiriciden cevap olabilir gibi görünüyor ama bir SFML ilgili soru çok olduğundan, sana temas almak için tavsiye ediyorum OS X için geliştirici ile (veya en azından her şeyi taşıdı) OS X: hirua. (Yoksa o da Stackoverflow'da mı?)

Ayrıca forumda SFML 2.0 kitaplığı oluşturmak (ve kullanmak) için bir instruction var. Belki de 1.6 sürümü için de yardımcı olur.

(Bu sadece bir yorum eklemek istiyorum ama benim itibar) o (büyük henüz görünüyor)

6

Sen Bağlayıcı seçeneklerine iki bayrak eklemeniz gerekir:

-framework SFML 

: Bu ek /Library/Frameworks/SFML.framework

yılında çerçevesini kullanma bağlayıcı söyler

, kullanmakta olduğunuz her kütüphane için -lsfml-whatever eklemem gerekir Mac OSX SFML docs inşa dan

g++ -framework SFML -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system 

Bu durumu net değildir, ancak her ikisi de gerekiyor:

Yani, gibi eksiksiz bir bağlayıcı çizgi görünebilir.

+0

Hayır, “frame SFML” işe yaramaz. Sadece üstbilgileri içeren kukla bir çerçeve. Dylibs'i yüklediyseniz, muhtemelen/usr/local/'dizinlerini de yüklediniz, böylece bu ekstra çerçeveye ihtiyacınız yok. – Hiura