-1

I am new in cpp programing i want move on game devlopment so i want run SFML simple project but i got some error and i am very disturbed please help me I am stucking in this last two week and i cant find any solution .......

||=== 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)) ===|
user4581301
  • 33,082
  • 7
  • 33
  • 54
  • But seriously, I hate the duplicate @Ripi2 has suggested, but without more information that and educated guesses are the best we can do for you. – user4581301 Aug 10 '18 at 16:33
  • The [documentation](https://www.sfml-dev.org/faq.php#build-link) tells you what you need to know. – Jesper Juhl Aug 10 '18 at 16:47
  • @user4581301 what so bad about that dupe in your opinion? – Jesper Juhl Aug 10 '18 at 16:48
  • 3
    @JesperJuhl Too many possible options all in one place. You drop that on a confused and frustrated person and reading through and trying more than one or two before giving up is going to be one of the less likely outcomes. But like I said, without more information to help an Asker narrow down which of the couple dozen possibilities presented in that omnibus is the right one for them it's the best we can do. Doesn't mean I have to like it. – user4581301 Aug 10 '18 at 16:59
  • @user4581301 Thank you for providing your perspective. I don't necessarily agree, but I can respect your position and I'm glad you took the time to tell me the "why". :) – Jesper Juhl Aug 10 '18 at 17:01
  • Sorry, but **I** don't know about SFML or its errors, so I can't help you. IOW, don't assume that one person knows everything. – Thomas Matthews Aug 10 '18 at 17:51
  • 1
    Please edit your text with command line of the compiler or the instructions you use to invoke the compiler. Review and verify that all details are present. – Thomas Matthews Aug 10 '18 at 17:52

1 Answers1

2

Probably you are missing to link SFML libraries. If you are using g++ try adding them like this:

g++ <your_sources> -lsfml-graphics -lsfml-window -lsfml-system
tuket
  • 3,232
  • 1
  • 26
  • 41