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 "" discussed on the webpage; unzip it into an easy-to-find directory such as C:\MinGW
  • Next, install the Code::Blocks IDE from -- 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:
Hope this helps somebody out there (perhaps even my future self?).

Thursday, March 29, 2012

(re)learning C++

I haven't really used C++ since my undergraduate days -- I've mostly worked in Java recently.  Feeling nostalgic, I decided to refresh these particular skills.  I'll be using the freely available C++ IDE called Code::Blocks (available at and the tutorials at (where Code::Blocks appears to be recommended above Dev-C++).  Running the "Hello World" program was easy, but to stop the exiting immediately, I recommend adding an int "dummy" variable and a "cin" to the standard code, e.g.,

// my first program in C++

#include <iostream>
using namespace std;

int main ()
  int pauseVariable;
  cout << "Hello World!" << endl;
  cout << "Type something and press Enter to continue..." << endl;
  cin >> pauseVariable;
  return 0;
P.S. Figured out syntax highlighting thanks to except that (at the time of posting) "Edit HTML" is located under the Template menu in your Blogger dashboard.
P.P.S. Code::Blocks integrates nicely with the Simple and Fast Multimedia Library -