How to solve “boost::bad_any_cast: failed conversion using boost::any_cast” when using boost program options?

后端 未结 4 1164
伪装坚强ぢ
伪装坚强ぢ 2021-01-01 16:40
//Using boost program options to read command line and config file data
    #include 
    using namespace std;
    using namespace b         


        
4条回答
  •  抹茶落季
    2021-01-01 17:11

    You need to declare the ip-address and port as strings when you add the options:

    config.add_options()
        ("IPAddress,i", po::value(), "IP Address")
        ("Port,p", po::value(), "Port")
        ;
    

提交回复
热议问题