code::blocks can't find dll

When I try and run the demo sfml code using codeblocks I get this error,
The program can't start because sfml-graphics-d-2.dll is missing from your computer.
Try reinstalling the program to fix this problem.

However there is such a file at C:\SFML-2.3.1\bin so why can't code::blocks find it?

The project is in the same directory, C:\SFML-2.3.1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <SFML/Graphics.hpp>

int main()
{
    // Create the main window
    sf::RenderWindow app(sf::VideoMode(800, 600), "SFML window");

    // Load a sprite to display
    sf::Texture texture;
    if (!texture.loadFromFile("cb.bmp"))
        return EXIT_FAILURE;
    sf::Sprite sprite(texture);

	// Start the game loop
    while (app.isOpen())
    {
        // Process events
        sf::Event event;
        while (app.pollEvent(event))
        {
            // Close window : exit
            if (event.type == sf::Event::Closed)
                app.close();
        }

        // Clear screen
        app.clear();

        // Draw the sprite
        app.draw(sprite);

        // Update the window
        app.display();
    }

    return EXIT_SUCCESS;
}

Last edited on
It's not code::blocks, your program has to find the dll. The programs will usually automatically search for dll in a few locations on Windows OS, and the dll has to be in one of them

Possible solutions
A) copy the .dll to windows/system32 directory (most reliable)
B) copy the .dll to the folder where the .exe file is. This will work only when running the .exe file from its directory.
C) copy the .dll in the directory of the project (your program wont search in /bin subdirectory). code::blocks runs .exe files from the directory of the project, so this should work only when code::blocks is running your program.
Last edited on
I had placed the dll in the system32 directory and still got the error.
I copied ALL the dlls in the bin directory to
C:/SFML-2.3.1
And also to C:/SFML/test/
which holds the project.

So now I get the error Entry Point Not Found
(x) The procedure entry point _ZSt24_throw_out_of_range_fmtPKcz could not be located in they dyamic link library libstdc++6.dll.
Ok, that is a different error. Try searcing on google. This one is related to linking with c++ standard library.
Topic archived. No new replies allowed.