2

我不明白为什么以下程序片段会出错:variable 'boost::program_options::options_description desc' has initializer but compatible type

有人能发现问题吗?

    #include <string>

    #include <boost/program_options/cmdline.hpp>
    #include <boost/filesystem.hpp>

    #include "Utility.hpp"
    #include "Common.hpp"

    using namespace std;
    using namespace boost;

    namespace
    {
      const size_t ERROR_IN_COMMAND_LINE = 1;
      const size_t SUCCESS = 0;
      const size_t ERROR_UNHANDLED_EXCEPTION = 2;

    } // namespace

    static void ParseTheCommandLine(int argc, char *argv[])
    {
        int count;

        std::string appName = boost::filesystem::basename(argv[0]);

        namespace po = boost::program_options;

        boost::program_options::options_description desc("Options");
    }
4

1 回答 1

2

你必须#include <boost/program_options/options_description.hpp>

于 2012-11-17T16:00:36.470 回答