Code::blocks problem

I installed Code::blocks without the MinGW. Then i installed separately MinGW in D:\ - i instructed Code::blocks to use MinGW from Settings -> Compiler and Debugger -> Global Compiler Settings -> Toolchain executables where I added D:\MinGW.
So far no problem, then i build a simple program in debug and release version and they both work when executed from Code::blocks.
But when I go in the folder where the binary files reside and try to execute them as standalone applications I get the following error
"This application has failed to start because libgcc_s_dw2-1.dll was not found. Re-installing the application may fix the problem"

If I install Code::blocks with the MinGW integrated - there is no problem, but if i get Code::blocks separately and MinGW then i can't run standalone programs.

If you know how to fix this please help me.

I use Windows XP SP3.
When you install the integrated version, it most likely puts the DLL in the "System32" folder. This is where the OS looks for DLL's. When you install the separate versions, the DLL may not get into your "System32" folder. Try looking through your MinGW and Code::Blocks files to find the DLL, then copy it to your "System32" folder. The path should look some like C:\WINDOWS\system32
You shouldn't use the official MinGW build, use this one instead: http://tdm-gcc.tdragon.net/
Code::Blocks comes bundled with TDM MinGW as well (with the 4.4.x version though).
Binaries built with TDM don't have any silly dependencies such as libgcc_s_dw2-1.dll.
Last edited on
@ ModShop: Dude, you're SO CLOSE it's killing me!

That "libgcc_s_dw2-1.dll" file is in "%PATH%\CodeBlocks\MinGW\bin\". The reason that this app runs from the IDE but not from the a.exe is that Code::Blocks executes your program from within a shell it makes when you run it from the IDE. This shell has it's own environment variables one of which tells the command prompt you start to check a set of directories for stuff like DLL's, the executables it needs to compile etc. Without the PATH variable set, your application does not know where to look for the libraries that it is relying on.

@ OP: When you install MingW, there is a setup phase that tells you to drop "C:\Mingw\bin\" into your system PATH. I'm willing to bet you didn't do this. In fact here's the link: http://www.mingw.org/wiki/Getting_Started#toc4

This should resolve your DLL issue.

EDIT: Athar has an interesting suggestion, overall this may be a better solution as it wouldn't require anyone using your binaries to have this DLL on their system. I'll be looking into this idea myself, thanks for the suggestion.
Last edited on
Guys thank you for your help. Athar i followed your link and it worked beautifully. I discarded the old MinGW and the new one solved it all.
Now if i may just ask how do i integrate Code::blocks with sfml library. I follow the instructions in www.sfml-dev.org but i cant get it to even start compiling.

I do everything the site tells me but when i hit compile and run - nothing seems to happen and there is no binary file in the project folder.

Now here is the funny part - when i reverse to my old MinGW (mingw-with-gcc-4.4) the one sfml recommends i get it to compile and run from Code::blocks but when i go the project folder and execute as standalone app. it gives the same error - missing dll file. It leaves me scratching my head for a week now :(


Thank you again for your quick and competent responses.
Last edited on
Topic archived. No new replies allowed.