How to fix boost::program_options "error: ‘po’ has not been declared"
If you want to compile your C++ project using boost::program_options
but you see error messages like
/home/uli/myProject/main.cpp:28:5: error: ‘po’ has not been declared
po::notify (vm);
you are missing this declaration which you need to place directly after #include <boost/program_options.hpp>
:
namespace po = boost::program_options;
This declares po
as an alias for the boost::program_options
namespace, because writing po::variables_map
is much easier to read than boost::program_options::variables_map
and using namespace boost::program_options
might cause some name collisions with other functions.