boost filesystem compile warnings – boost system posix_category defined but not used

If you are using boost::filesystem in your C++ code and getting are some build warnings along the lines of:

 

‘boost::system::posix_category’ defined but not used

 

Then you may find that inserting the following code before #including boost/filesystem gets rid of them for you:

#ifndef BOOST_SYSTEM_NO_DEPRECATED
#define BOOST_SYSTEM_NO_DEPRECATED 1
#endif
#include 

This gets rid of some the deprecated stuff that was causing the warnings.

 

I found this handy tip here:

 

http://stackoverflow.com/questions/1814548/boostsystem-category-defined-but-not-used