首页 文章

boost无法使用apple llvm program_options进行编译

提问于
浏览
0

我使用的是LLVM GCC 4.2编译器,但出于某种原因我想使用Apple LLVM编译器 . 我使用一些静态链接的boost库 .

我的代码部分在这里:

#include <boost/program_options/detail/config_file.hpp>

std::set<std::string> options;
std::map<std::string, std::string> parameters;
options.insert("*");

for (config_file_iterator i(config, options), e ; i != e; ++i) 
    parameters[i->string_key] = i->value[0];

当我将Xcode 4.5.1中的编译器更改为Apple LLVM 4.1时,它给了我这个错误:

In file included from A.cpp:16:
    boost_1_46_1/boost/program_options/detail/config_file.hpp:163:17: error: 
    call to function 'to_internal' that is neither visible in the template 
    definition nor found by argument-dependent lookup
        s = to_internal(in);
            ^
    A.cpp:82:39: note: in instantiation of member function
    'boost::program_options::detail::basic_config_file_iterator::getline' 
    requested here
        for (config_file_iterator i(config, options), e ; i != e; ++i) 
                                  ^
    boost_1_46_1/boost/program_options/detail/convert.hpp:70:48: note: 
    'to_internal' should be declared prior to the call site or 
    in namespace '__gnu_cxx' 
        BOOST_PROGRAM_OPTIONS_DECL std::string to_internal(const std::string&);

enter image description here

有人知道解决方案是什么?

1 回答

  • 1

    请在 detail/config_file.hpp 的顶部找到以下行:

    #include <boost/program_options/detail/convert.hpp>
    

    并删除该行周围的 #if#endif . 之后一切都应该建好 . 该修补程序已包含在当前版本中 .

相关问题