I have a problem with boost::program_options
i have a class
namespace po = boost::program_options;
class imageProcess{
private:
po::options_description options;
public:
imageProcess(int argc,char** argv){
po::options_description desc("Allowed options");
this->options = desc;
It gives me these errors:
non-static const member ‘const unsigned int
boost::program_options::options_description::m_min_description_length’,
can’t use default assignment operator imgproc line 163, external
location:
/usr/include/boost/program_options/options_description.hpp C/C++
Problem non-static const member ‘const unsigned int
boost::program_options::options_description::m_line_length’, can’t use
default assignment operator imgproc line 163, external location:
/usr/include/boost/program_options/options_description.hpp C/C++
Problem use of deleted function
‘boost::program_options::options_description&
boost::program_options::options_description::operator=(const
boost::program_options::options_description&)’ imageProcess.cpp /imgproc/src line
20 C/C++ Problem
What should i do to make options field instance of po::options_description?
EDIT:
I know options field is already an instance but is there a way to set the description “Allowed options” after defining this field(po::options_description options(“allowed options”); doesnt work too)? And how i should store previously created instances of object into class fields?
Read your errors:
They indicate that
boost::program_options::options_descriptiondoes not support the assignment operatoroperator=in your version of Boost (actually since v1.33), due to theconstmember withinoptions_description.You’ll have to — and anyway should — initialise your
options_descriptioninstance using the ctor-initializer:The line starting
:is where your constructor arguments for the memberoptionsgo.