So I was told sfml was a good way to start creating 2d windows and graphics in c++, however I am running into a problem on installation and set-up. I have followed the tutorial on the website and downloaded the correct version (I have the libgcc_s_dw2-1.dll present in my MinGW, so I downloaded the 32bit DW2 version, my CodeBlocks is version 13.12, and as said I have followed the tutorial.
However I am getting a "System Error", which says:
"The Program can't start because sfml-graphics-2.dll is missing from your computer. Try reinstalling the program to fix this problem."
Anyone have any idea what I have done wrong, or how to fix it?
Copy that dll file to the same directory as your .exe. You may need to search some sfml directories to find it.
On windows dll files required by programs must be somewhere in the current PATH or the current directory.
Im gonna level w/ you. I have no idea what that means.
I dont really understand what to do tbh. what is my .exe? my codeblocks, what folder in codeblocks, where? I dont really understand compilers or any of the directory stuff, just how to code.
When you compile/link a program on Windows that produces an executable file with the extension .exe. This .exe file is what someone would run to execute your code. DLL files are collections of someone else's code (or possibly your own) that is not meant to be run by itself. They are typically used when lots of programs would benefit from having "shared" code. So many programs can execute functions from DLL files, but only if the operating system running your program can locate the DLL file that is requested. On windows this means the DLL has to be in one of the locations listed in the system environment PATH variable or the directory that the .exe file is in. If you would like to view your PATH variable, just open a command prompt and type
Well I assume somewhere in your project folder CodeBlocks makes some subfolders where it might be. It depends on where your CodeBlocks is configured to output the executables.
You can always copy and paste it to a location that is already in your PATH variable.
okay, so i found where sfml-graphics-2.dll was located and also looked at the echo %path% and found that it was in MinGW bin, so i pasted it in there. I went back to test and for some reason the project build options have reset and everything I typed up such as linker settings etc. are gone. Will I have to do this everytime i open codeblocks? Surely not..
yeah, I have no idea what is going on, every-time i boot up codeblocks everything is reset and I have to type in the same stuff into the build options, is there not anyway to save it was a default thing?
Ignoring the fact that it resets, it still tells me it cant find "sfml-graphics-2.dll" despite the fact that I have pasted it into the "path" which said was in the bin of MinGW?
Someone else who is more familiar with CodeBlocks will have to help you with those problems.
The DLL should be findable based on what you said. Have you also tried putting the missing DLL into the bin\Release folder?
release folder? I searched my pc for it, found it, copied it then just looked up the echo thing as saw it went into MinGW then bin so I pasted it in there and am still having a problem. Not sure if that's what you meant for me to do?
yeah, I have no idea what is going on, every-time i boot up codeblocks everything is reset and I have to type in the same stuff into the build options, is there not anyway to save it was a default thing?
next time before you exit try clicking file/save everything. It should not reset each time.
You can also use global settings click settings/compiler. Changes you make here apply to all projects.
Ignoring the fact that it resets, it still tells me it cant find "sfml-graphics-2.dll" despite the fact that I have pasted it into the "path" which said was in the bin of MinGW?
pasting the dll to MinGW/bin is wrong. Go to your project folder. Open the bin folder. Inside you should see a folder named release past the dll file in there.