我正在尝试让SFML处理code :: blocks,但每当我尝试测试示例代码时,我都会遇到错误。我按照http://www.sfml-dev.org/tutorials/2.0/start-cb.php的教程进行了操作,但似乎没有用。
我对此并不擅长,所以如果有人能帮助它,那就太棒了。
以下是代码和错误的屏幕截图:http://i39.tinypic.com/nbdysj.jpg
以下是错误:
obj\Debug\test.o||In function `main':|
C:\Users\Mads\Desktop\test\test.cpp|5|undefined reference to `sf::String::String(char const*, std::locale const&)'|
C:\Users\Mads\Desktop\test\test.cpp|5|undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
C:\Users\Mads\Desktop\test\test.cpp|5|undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'|
C:\Users\Mads\Desktop\test\test.cpp|6|undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'|
C:\Users\Mads\Desktop\test\test.cpp|5|undefined reference to `sf::RenderWindow::~RenderWindow()'|
C:\Users\Mads\Desktop\test\test.cpp|7|undefined reference to `sf::Color::Green'|
C:\Users\Mads\Desktop\test\test.cpp|7|undefined reference to `sf::Shape::setFillColor(sf::Color const&)'|
C:\Users\Mads\Desktop\test\test.cpp|15|undefined reference to `sf::Window::close()'|
C:\Users\Mads\Desktop\test\test.cpp|12|undefined reference to `sf::Window::pollEvent(sf::Event&)'|
C:\Users\Mads\Desktop\test\test.cpp|18|undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'|
C:\Users\Mads\Desktop\test\test.cpp|18|undefined reference to `sf::RenderTarget::clear(sf::Color const&)'|
C:\Users\Mads\Desktop\test\test.cpp|19|undefined reference to `sf::RenderStates::Default'|
C:\Users\Mads\Desktop\test\test.cpp|19|undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'|
C:\Users\Mads\Desktop\test\test.cpp|20|undefined reference to `sf::Window::display()'|
C:\Users\Mads\Desktop\test\test.cpp|9|undefined reference to `sf::Window::isOpen() const'|
C:\Users\Mads\Desktop\test\test.cpp|23|undefined reference to `sf::RenderWindow::~RenderWindow()'|
C:\Users\Mads\Desktop\test\test.cpp|23|undefined reference to `sf::RenderWindow::~RenderWindow()'|
obj\Debug\test.o||In function `~CircleShape':|
C:\Users\Mads\Desktop\SFML-2.0\include\SFML\Graphics\CircleShape.hpp|42|undefined reference to `vtable for sf::CircleShape'|
C:\Users\Mads\Desktop\SFML-2.0\include\SFML\Graphics\CircleShape.hpp|42|undefined reference to `vtable for sf::CircleShape'|
C:\Users\Mads\Desktop\SFML-2.0\include\SFML\Graphics\CircleShape.hpp|42|undefined reference to `sf::Shape::~Shape()'|
||=== Build finished: 20 errors, 0 warnings ===|
答案 0 :(得分:0)
我遇到了同样的问题,我必须做两个步骤才能让它发挥作用。
1)手动编译SFML而不是使用打包版本。
2)在构建选项中将手动编译的版本添加到项目中。
在此之前,即使我按照文档中的描述指定了所有内容,我仍然会不断收到这些错误。
答案 1 :(得分:0)
您应该添加到您的CB项目文件* .cbp:
<Linker>
<Add library="GL" />
</Linker>