New Code::Blocks 10.05 "exit is not a member" fix

There’s a new version of Code::Blocks available, and when you try to compile the OF emptyExample it says:

error: ‘exit’ is not a member of ‘std’

You can fix this by going into ofConstants.h and changing this line:

  
#include <stdlib.h>  

To:

  
#include <cstdlib>  

This is part of a more general weirdness with OF in that it’s mixing C and C++ headers. The C++ headers are backwards compatible with C, so I would recommend changing all the following in ofConstants.h to their C++ equivalents:

  
  
#include <stdio.h>  
#include <stdarg.h>  
#include <math.h>  
#include <time.h>  
#include <stdlib.h>  
#include <string.h>  
  

That is:

  
  
#include <cstdio>  
#include <cstdarg>  
#include <cmath>  
#include <ctime>  
#include <cstdlib>  
#include <string>  
  

Notice that #include is already present, so it can be left out.

Actually, if those changes are made, I’d like to request that this line is added:

  
  
#include <fstream>  
  

So file io can be accomplished easily using streams.

thank you! this and http://forum.openframeworks.cc/t/opencv-2.0-and-of-/2994/26 helped getting my app running in new version of Code::Blocks

Also discussed in this thread http://forum.openframeworks.cc/t/small-corrections-for-gcc-4.4/3093/1

Added as an issue to the OF project on github, to be resolved for r62 it seems: http://github.com/openframeworks/openFrameworks/issuesearch?state=open&q=blocks#issue/231