So as the title suggests, when I try building & running my program using Code::Blocks (not that it may have anything to do with this problem, just thought it would be essential to add in), I get that error.
Did you #include <Windows.h> and linked against Comdlg32.lib? Don't ask me how to configure the linker in Code::Blocks, though. I only use Visual Studio.