I've been checking stack overflow and some blogs and kept trying various things. I finally managed to launch it normally. For anyone who might have had the same problem, the solution is to pass "-L-lgtkd -L-ldl" to the command line. Project -> Properties -> Command Line -> Additional Options.