gpt4 book ai didi

c++ - 编译器告诉我变量 "has initializer but incomplete type"有什么问题?

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:53:22 25 4
gpt4 key购买 nike

我不明白为什么下面的程序片段会报错:variable ‘boost::program_options::options_description desc’ has initializer but incomplete 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");
}

最佳答案

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

关于c++ - 编译器告诉我变量 "has initializer but incomplete type"有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13432201/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com