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
#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;
}
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.
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.