2011-12-17 11 views
5

पर लिंकर त्रुटियां यह काफी 'नोब' प्रश्न की तरह लग सकती है: मैंने मैक के लिए एसएफएमएल-1.6 डाउनलोड किया है और मैंने फ्रेमवर्क को मेरे/लाइब्रेरी/फ्रेमवर्क फ़ोल्डर में रखा है। एक उदाहरण एसएफएमएल एप्लिकेशन को संकलित करने का प्रयास करने के बाद मुझे एसएफएमएल में जितनी भी कॉल मैं कॉल करता हूं, उसके लिए लिंकर त्रुटियां मिलती हैं। मुझे यकीन नहीं है कि मुझे क्या याद आ रही है? मुझे ओएसएक्स और फ्रेमवर्क के साथ ज्यादा अनुभव नहीं मिला है, इसलिए शायद मुझे पुस्तकालयों से किसी अन्य विधि से लिंक करने की आवश्यकता है?ओएस एक्स

आउटपुट, अगर यह मदद करता है:

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) 

उत्तर

2

ऐसा लगता है तुम्हारी समस्या भी ओएस एक्स पर एक अनुभवी डेवलपर की ओर से जवाब दिया जा सकता है, लेकिन क्योंकि यह एक SFML संबंधित प्रश्न भी है, मैं सलाह चाहते हैं आप संपर्क में प्राप्त करने के लिए ओएस एक्स: hirua के लिए एसएफएमएल के डेवलपर (या कम से कम उसने पूरी चीज को पोर्ट किया) के साथ। (या वह यहां स्टैक ओवरफ्लो पर भी है?)

इसके अतिरिक्त फोरम में SFML 2.0 लाइब्रेरी के निर्माण (और उपयोग) के लिए instruction है। शायद यह आपके 1.6 संस्करण के लिए भी मदद करता है।

(मैं यह सिर्फ एक टिप्पणी जोड़ना चाहते हैं लेकिन ऐसा लगता है मेरी प्रतिष्ठा है कि अभी तक महान (नहीं है))

6

आप लिंकर विकल्प के लिए दो झंडे जोड़ने की आवश्यकता होगी:

-framework SFML 

:

यह लिंकर बताता /Library/Frameworks/SFML.framework

में ढांचे का उपयोग करने के अलावा, आप प्रत्येक पुस्तकालय के लिए -lsfml-whatever शामिल करने के लिए उपयोग किए जा रहे है

तो, एक पूरा लिंकर लाइन लग सकता है जैसे:

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

यह तुरंत स्पष्ट नहीं है से मैक OSX SFML डॉक्स का निर्माण, लेकिन आप दोनों की जरूरत है।

+0

नहीं, '-फ्रेमवर्क एसएफएमएल' बेकार है। यह एक डमी ढांचा है जिसमें केवल शीर्षलेख होते हैं। यदि आपने डाइलीब स्थापित किए हैं तो संभवतः आपने '/ usr/local /' में हेडर इंस्टॉल किए हैं, इसलिए आपको इस अतिरिक्त ढांचे की आवश्यकता नहीं है। – Hiura