SFML

I am trying to Get SFML to work with code blocks but it just wont! I followed the tutorial on the site exactly as it said. But I keep getting an error.

main.cpp||undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
main.cpp||undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, std::string const&, unsigned long, sf::WindowSettings const&)'|
main.cpp||undefined reference to `sf::Window::IsOpened() const'|
main.cpp||undefined reference to `sf::Window::GetEvent(sf::Event&)'|
main.cpp||undefined reference to `sf::Window::Close()'|
main.cpp||undefined reference to `sf::RenderWindow::~RenderWindow()'|
main.cpp||undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'|
main.cpp||undefined reference to `sf::RenderTarget::Clear(sf::Color const&)'|
main.cpp||undefined reference to `sf::Window::Display()'|
main.cpp||undefined reference to `sf::RenderWindow::~RenderWindow()'|
||=== Build finished: 10 errors, 0 warnings (0 minutes, 0 seconds) ===|
I suspect you didn't link in the SFML library. Unfortunately, I can't help you with how to do that unless I know more about your environment.
If by link you mean following the steps here http://www.sfml-dev.org/tutorials/1.6/start-cb.php then I already have.
I'm not familiar with C::B but if you followed the instructions exactly I'm not sure what the problem is. The errors you are getting, however, definitely indicate the library wasn't linked properly. Maybe double-check your spelling and such?
How are you adding the library files to the project? I know of two ways.
Can you locate the folder SFML-1.6-sdk-windows-mingw ?
Are you linking dynamically? ( SFML_DYNAMIC as per the last screenshot).

You can either copy the library files to your project folder, or you can give a path to each using the pane "link libraries" in the next to last screenshot. Use "add" then "browse" to add a path for each of the libraries below.

If you are linking dynamically then you will need at least:
sfml-system.dll
sfml-window.dll

And, if using graphics
sfml-graphics.dll

Two others can be found in your MinGW\bin folder
libgcc_s_dw2-1.dll
libstdc++-6.dll
Last edited on
Thanks for the help guys, but something really weird happened when I linked sfml-graphics, It started this time. But then I got an error saying this program couldn't start because sfml-graphics.dll is missing from your system. Now I am even more confused!
Your program should now compile, link and run fine. If you linked against the dynamic versions of the SFML libraries, don/t forget to copy the corresponding DLLs (sfml-system.dll in this case) to your executable's directory, or to a directory contained in the PATH environment variable.


From the tutorial you linked above.
Last edited on
I got an error saying this program couldn't start because sfml-graphics.dll is missing from your system

Put sfml-graphics.dll (which is somewhere in the SFML folder you downloaded) in the same directory as your .exe.
Last edited on
Topic archived. No new replies allowed.