boost::system::(...)_category defined but not used

Anonymous picture Anonymous · Nov 29, 2009 · Viewed 7.5k times · Source

I'm currently getting compiler warnings that resemble the warning I gave in the question title. Warnings such as....

warning: 'boost::system::generic_category' defined but not used

warning: 'boost::system::posix_category' defined but not used

warning: 'boost::system::errno_ecat' defined but not used

warning: 'boost::system::native_ecat' defined but not used

As far as I know the program isn't being affected in any way. However, I don't like warnings hanging around, but I have no idea what these warnings are trying to tell me besides that something defined and related to boost is hanging around somewhere not being used. However, everything that I've defined, I've used. The boost libraries I'm using are the random library and the filesystem library.

When I check the source of the warning it brings up Boost's error_category.hpp file and highlights some static consts that are commented as either "predefined error categories" or "deprecated synonyms". Maybe the problem has something to do with my error handling (or lack of) when using the library?

Can anyone give some insight regarding why these warnings are popping up? Am I completely missing something?

P.S. Warnings are at max level.

Answer

M. Tibbits picture M. Tibbits · Sep 17, 2010

I agree with @Charles Salvia, but wanted to add that at least as of Boost 1.44.0, these definitions are now wrapped -- to be excluded as deprecated. So if you aren't using them, just include the following lines before you include the header file:

#ifndef BOOST_SYSTEM_NO_DEPRECATED
#define BOOST_SYSTEM_NO_DEPRECATED 1
#endif