Friday, March 30, 2012

Simple Fast Multimedia Library - setup with Code::Blocks

I love this library.  Compiling and running the basic program was a bit tricky; I had a bunch of "libgcc_s_dw2-1.dll is missing" errors.  What I ended up doing to solve these errors was:
  • First, download the compiler "mingw-with-gcc-4.4.zip" discussed on the webpage http://www.sfml-dev.org/tutorials/1.6/start-cb.php; unzip it into an easy-to-find directory such as C:\MinGW
  • Next, install the Code::Blocks IDE from http://www.codeblocks.org/downloads/26 -- but choose the one that does not include MinGW. When installing, if Code::Blocks doesn't automatically find the MinGW directory you set up earlier, you can configure the compiler afterwards as follows: 
    • In the menu bar, go to "Settings", select "Compiler and Debugger..."
    • In the new window make sure the "Global Compiler Settings" image on the left is highlighted/selected
    • In the "Selected Compiler" dropdown list choose "GNU GCC Compiler"
    • In the tabs underneath the dropdown list, click on "Toolchain Executables". 
    • There will be a textbox where you can type the name of the directory where you unzipped the MinGW compiler
  • In the window described above
    ("Settings -> "Compiler and Debugger..." -> "Global Compiler Settings"), click the "Linker Settings" tab, and in the textbox labelled "Other Linker Options", enter the following five lines of text:
            -static-libgcc
            -static-libstdc++
            -lsfml-graphics
            -lsfml-window
            -lsfml-system
Hope this helps somebody out there (perhaps even my future self?).