我使用本教程http://www.sfml-dev.org/tutorials/2.0/start-cb.php将SFML添加到我的Code :: Blocks项目中,但是我遇到了这样的错误:
undefined reference to sf::Texture::getSize() const
undefined reference to sf::Sprite::Sprite()
undefined reference to sf::Sprite::setTexture(sf::Texture const&, bool)
以下是我设置的屏幕截图:
班轮设置:
编译器的搜索目录:
链接器的搜索目录:
编译器设置:
||=== Build: Release in Space (compiler: GNU GCC Compiler) ===|
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Sprite::Sprite()'
undefined reference to `sf::Sprite::setTexture(sf::Texture const&, bool)'
undefined reference to `sf::Transformable::setPosition(float, float)'
undefined reference to `sf::Sprite::Sprite()'
undefined reference to `sf::Sprite::setTexture(sf::Texture const&, bool)'
undefined reference to `sf::Transformable::setPosition(float, float)'
undefined reference to `sf::RenderStates::Default'
undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
undefined reference to `vtable for sf::Sprite'
undefined reference to `vtable for sf::Sprite'
undefined reference to `sf::Transformable::~Transformable()'
(.text$_ZN2sf6SpriteD1Ev[__ZN2sf6SpriteD1Ev]+0x3e)
undefined reference to `vtable for sf::Sprite'
(.text$_ZN2sf6SpriteD1Ev[__ZN2sf6SpriteD1Ev]+0x45)
undefined reference to `vtable for sf::Sprite'
(.text$_ZN2sf6SpriteD1Ev[__ZN2sf6SpriteD1Ev]+0x57)
undefined reference to `sf::Transformable::~Transformable()'|
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Texture::getSize() const'
undefined references to `sf::Texture::getSize() const' follow
undefined reference to `sf::Clock::Clock()'
undefined reference to `sf::seconds(float)'
undefined reference to `sf::Time::Time()'
undefined reference to `sf::operator<(sf::Time, sf::Time)'
undefined reference to `sf::Time::Zero'
undefined reference to `sf::Time::Zero'
undefined reference to `sf::Clock::restart()'
undefined reference to `sf::operator+=(sf::Time&, sf::Time)'
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Texture::getSize() const'
undefined reference to `sf::Sprite::Sprite()'
undefined reference to `sf::Sprite::setTexture(sf::Texture const&, bool)'
undefined reference to `sf::Transformable::setPosition(float, float)'
undefined reference to `sf::Sprite::Sprite()'
undefined reference to `sf::Sprite::setTexture(sf::Texture const&, bool)'
undefined reference to `sf::Transformable::setPosition(float, float)'
undefined reference to `sf::RenderStates::Default'
undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'|
undefined reference to `vtable for sf::Sprite'
undefined reference to `vtable for sf::Sprite'
undefined reference to `sf::Transformable::~Transformable()'
undefined reference to `sf::Sprite::getGlobalBounds() const'
undefined reference to `sf::Sprite::getTextureRect() const'
undefined reference to `sf::Transformable::getScale() const'
undefined reference to `sf::Transformable::getTransform() const'
undefined reference to `sf::Sprite::getTextureRect() const'
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
答案 0 :(得分:2)
我想我弄明白了你的问题。我怀疑你需要从这里http://www.sfml-dev.org/download/sfml/2.1/下载SFML GCC 4.7 TDM(SJLJ) - 32位 - 你可能使用了错误版本的库。