SFML错误,我知道您对此有所了解

时间:2018-08-10 16:25:52

标签: c++ sfml

我是cpp编程的新手,我想继续发展游戏,因此我想运行SFML简单项目,但是我遇到了一些错误,我非常不安,请帮助我 我被困在过去的两个星期里,我找不到任何东西 解决方案.......

||=== Build: Debug in test (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
D:\programms\test\main.cpp|5|undefined reference to `sf::String::String(char const*, std::locale const&)'|
D:\programms\test\main.cpp|5|undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
D:\programms\test\main.cpp|5|undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'|
D:\programms\test\main.cpp|6|undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'|
D:\programms\test\main.cpp|7|undefined reference to `sf::Color::Green'|
D:\programms\test\main.cpp|7|undefined reference to `sf::Shape::setFillColor(sf::Color const&)'|
D:\programms\test\main.cpp|9|undefined reference to `sf::Window::isOpen() const'|
D:\programms\test\main.cpp|12|undefined reference to `sf::Window::pollEvent(sf::Event&)'|
D:\programms\test\main.cpp|15|undefined reference to `sf::Window::close()'|
D:\programms\test\main.cpp|18|undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'|
D:\programms\test\main.cpp|18|undefined reference to `sf::RenderTarget::clear(sf::Color const&)'|
D:\programms\test\main.cpp|19|undefined reference to `sf::RenderStates::Default'|
D:\programms\test\main.cpp|19|undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'|
D:\programms\test\main.cpp|20|undefined reference to `sf::Window::display()'|
D:\programms\test\main.cpp|5|undefined reference to `sf::RenderWindow::~RenderWindow()'|
D:\programms\test\main.cpp|5|undefined reference to `sf::RenderWindow::~RenderWindow()'|
D:\programms\test\main.cpp|5|undefined reference to `sf::RenderWindow::~RenderWindow()'|
obj\Debug\main.o||In function `ZN2sf11CircleShapeD1Ev':|
D:\CodeBlocks\sfml\include\SFML\Graphics\CircleShape.hpp|41|undefined reference to `vtable for sf::CircleShape'|
D:\CodeBlocks\sfml\include\SFML\Graphics\CircleShape.hpp|41|undefined reference to `vtable for sf::CircleShape'|
D:\CodeBlocks\sfml\include\SFML\Graphics\CircleShape.hpp|41|undefined reference to `sf::Shape::~Shape()'|
||error: ld returned 1 exit status|
||=== Build failed: 21 error(s), 0 warning(s) (0 minute(s), 7 second(s)) ===|

1 个答案:

答案 0 :(得分:1)

可能您缺少链接SFML库的链接。 如果您使用的是g++,请尝试这样添加它们:

g++ <your_sources> -lsfml-graphics -lsfml-window -lsfml-system