0

我在我的 Debian 7 64 位 Linux 机器上编译了 Boost 1.54 并成功安装。

但是,当尝试在我的项目中使用它时,我遇到了一大堆错误(完整转储在这里: http: //pastebin.com/zUTcb7vp)。

我尝试创建一个简单的测试应用程序,如下所示(保存在 main.cpp 中):

#include <boost/log/trivial.hpp>
#include <boost/log/utility/init/to_file.hpp>

int main(int, char*[])
{
    BOOST_LOG_TRIVIAL(trace) << " a trace message ";
}

这也无法编译。我收到以下错误(堆栈溢出的字符太多无法处理 - 此处的完整堆栈跟踪:http: //pastebin.com/xiXZZVYb):

g++ -o build/main.o -c -std=c++11 -Wall -g -O0 src/main.cpp
In file included from /usr/local/include/boost/log/utility/init/to_file.hpp:31:0,
                 from src/main.cpp:2:
/usr/local/include/boost/log/detail/prologue.hpp:253:36: error: declaration of namespace ‘boost::log’ conflicts with
In file included from /usr/local/include/boost/log/trivial.hpp:20:0,
                 from src/main.cpp:1:
/usr/local/include/boost/log/detail/config.hpp:371:15: error: previous declaration of namespace ‘boost::log’ here
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:59:20: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:59:20: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:59:43: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp: In function ‘int boost::log2_mt_posix::aux::setup_file_collector(const ArgsT&, const true_&)’:
/usr/local/include/boost/log/utility/init/to_file.hpp:61:24: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:61:24: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:61:47: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp: At global scope:
/usr/local/include/boost/log/utility/init/to_file.hpp:64:20: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:64:20: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:64:43: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp: In function ‘int boost::log2_mt_posix::aux::setup_file_collector(const ArgsT&, const false_&)’:
/usr/local/include/boost/log/utility/init/to_file.hpp:66:12: error: ‘sinks’ has not been declared
/usr/local/include/boost/log/utility/init/to_file.hpp: At global scope:
/usr/local/include/boost/log/utility/init/to_file.hpp:72:5: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:72:5: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:75:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp: In function ‘int boost::log2_mt_posix::aux::init_log_to_file(const ArgsT&)’:
/usr/local/include/boost/log/utility/init/to_file.hpp:77:13: error: ‘sinks’ does not name a type
/usr/local/include/boost/log/utility/init/to_file.hpp:78:17: error: ‘backend_t’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:78:27: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:78:38: error: invalid type in declaration before ‘=’ token
/usr/local/include/boost/log/utility/init/to_file.hpp:78:60: error: the value of ‘backend_t’ is not usable in a constant expression
/usr/local/include/boost/log/utility/init/to_file.hpp:78:17: note: ‘backend_t’ was not declared ‘constexpr’
/usr/local/include/boost/log/utility/init/to_file.hpp:80:17: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:80:17: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:80:40: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:80:53: error: invalid type in declaration before ‘=’ token
/usr/local/include/boost/log/utility/init/to_file.hpp:81:63: error: ‘keywords’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:81:63: note: suggested alternatives:
In file included from /usr/local/include/boost/log/trivial.hpp:21:0,
                 from src/main.cpp:1:
/usr/local/include/boost/log/keywords/severity.hpp:29:20: note:   ‘boost::log::v2s_mt_posix::keywords’
/usr/local/include/boost/log/keywords/severity.hpp:29:20: note:   ‘boost::log::v2s_mt_posix::keywords’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:81:91: error: template argument 2 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:81:99: error: expected ‘(’ before ‘&gt;’ token
/usr/local/include/boost/log/utility/init/to_file.hpp:81:99: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:84:17: error: base operand of ‘->’ is not a pointer
/usr/local/include/boost/log/utility/init/to_file.hpp:85:17: error: base operand of ‘->’ is not a pointer
/usr/local/include/boost/log/utility/init/to_file.hpp:85:39: error: ‘keywords’ is not a class, namespace, or enumeration
/usr/local/include/boost/log/utility/init/to_file.hpp:85:63: error: ‘sinks’ is not a class, namespace, or enumeration
/usr/local/include/boost/log/utility/init/to_file.hpp:88:17: error: the value of ‘sinks’ is not usable in a constant expression
/usr/local/include/boost/log/utility/init/to_file.hpp:80:17: note: ‘sinks’ was not declared ‘constexpr’
/usr/local/include/boost/log/utility/init/to_file.hpp:88:68: error: type/value mismatch at argument 1 in template parameter list for ‘template<class T> class boost::shared_ptr’
/usr/local/include/boost/log/utility/init/to_file.hpp:88:68: error:   expected a type, got ‘sinks’
/usr/local/include/boost/log/utility/init/to_file.hpp:88:76: error: invalid type in declaration before ‘=’ token
/usr/local/include/boost/log/utility/init/to_file.hpp:89:29: error: the value of ‘sinks’ is not usable in a constant expression
/usr/local/include/boost/log/utility/init/to_file.hpp:80:17: note: ‘sinks’ was not declared ‘constexpr’
/usr/local/include/boost/log/utility/init/to_file.hpp:89:16: error: parse error in template argument list
/usr/local/include/boost/log/utility/init/to_file.hpp:89:90: error: no matching function for call to ‘make_shared(int&)’
/usr/local/include/boost/log/utility/init/to_file.hpp:89:90: note: candidates are:
In file included from /usr/local/include/boost/smart_ptr/make_shared.hpp:15:0,
                 from /usr/local/include/boost/make_shared.hpp:15,
                 from /usr/local/include/boost/log/utility/init/to_file.hpp:23,
                 from src/main.cpp:2:
/usr/local/include/boost/smart_ptr/make_shared_object.hpp:138:72: note: template<class T> typename boost::detail::sp_if_not_array::type boost::make_shared()
/usr/local/include/boost/smart_ptr/make_shared_object.hpp:138:72: note:   template argument deduction/substitution failed:
In file included from /usr/local/include/boost/smart_ptr/make_shared.hpp:15:0,
                 from /usr/local/include/boost/make_shared.hpp:15,
                 from /usr/local/include/boost/log/utility/init/to_file.hpp:23,
                 from src/main.cpp:2:
/usr/local/include/boost/smart_ptr/make_shared_object.hpp:210:99: note: template<class T, class Arg1, class ... Args> typename boost::detail::sp_if_not_array<T>::type boost::make_shared(Arg1&&, Args&& ...)
/usr/local/include/boost/smart_ptr/make_shared_object.hpp:210:99: note:   template argument deduction/substitution failed:
In file included from /usr/local/include/boost/smart_ptr/make_shared.hpp:18:0,
                 from /usr/local/include/boost/make_shared.hpp:15,
                 from /usr/local/include/boost/log/utility/init/to_file.hpp:23,
                 from src/main.cpp:2:
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:24:5: note: template<class T> typename boost::detail::sp_if_array::type boost::make_shared(std::size_t)
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:24:5: note:   template argument deduction/substitution failed:
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:42:5: note: template<class T, class ... Args> typename boost::detail::sp_if_array<T>::type boost::make_shared(std::size_t, Args&& ...)
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:42:5: note:   template argument deduction/substitution failed:
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:59:5: note: template<class T, class ... Args> typename boost::detail::sp_if_size_array<T>::type boost::make_shared(Args&& ...)
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:59:5: note:   template argument deduction/substitution failed:
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:80:5: note: template<class T> typename boost::detail::sp_if_size_array::type boost::make_shared(const T&)
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:80:5: note:   template argument deduction/substitution failed:
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:102:5: note: template<class T> typename boost::detail::sp_if_array::type boost::make_shared(std::size_t, const typename boost::detail::array_inner<T>::type&)
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:102:5: note:   template argument deduction/substitution failed:
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:126:5: note: template<class T> typename boost::detail::sp_if_size_array::type boost::make_shared(const typename boost::detail::array_inner<T>::type&)
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:126:5: note:   template argument deduction/substitution failed:
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:150:5: note: template<class T> typename boost::detail::sp_if_array::type boost::make_shared(std::initializer_list<typename boost::detail::array_inner<T>::type>)
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:150:5: note:   template argument deduction/substitution failed:
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:172:5: note: template<class T> typename boost::detail::sp_if_array::type boost::make_shared(std::size_t, typename boost::detail::array_base<T>::type&&)
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:172:5: note:   template argument deduction/substitution failed:
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:190:5: note: template<class T> typename boost::detail::sp_if_size_array::type boost::make_shared(typename boost::detail::array_base<T>::type&&)
/usr/local/include/boost/smart_ptr/make_shared_array.hpp:190:5: note:   template argument deduction/substitution failed:
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:91:5: error: ‘setup_filter’ is not a member of ‘boost::log2_mt_posix::aux’
/usr/local/include/boost/log/utility/init/to_file.hpp:91:5: note: suggested alternative:
...
...
TO MANY CHARACTERS - HAD TO TRUNCATE IT DOWN
...
...
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: ‘sinks’ was not declared in this scope
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: note: suggested alternatives:
In file included from /usr/local/include/boost/log/sources/basic_logger.hpp:38:0,
                 from /usr/local/include/boost/log/sources/severity_logger.hpp:23,
                 from /usr/local/include/boost/log/trivial.hpp:22,
                 from src/main.cpp:1:
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
/usr/local/include/boost/log/core/core.hpp:41:17: note:   ‘boost::log::v2s_mt_posix::sinks’
In file included from src/main.cpp:2:0:
/usr/local/include/boost/log/utility/init/to_file.hpp:170:1: error: template argument 1 is invalid

我删除了该#include <boost/log/utility/init/to_file.hpp>行,但它仍然无法编译。

有人知道到底发生了什么吗?

4

1 回答 1

0

原来,我需要删除 和 中以前的 Boost 文件/usr/local/include/boost/usr/local/lib/libboost*然后安装新版本。

另外,我必须BOOST_LOG_DYN_LINK在我的 cpp 文件中定义(以便我的应用程序可以与 Boost Log 动态链接 - 我想我将它构建为共享库?我不确定为什么它不能只与静态链接或动态链接一起使用它自己,但它没有)。

感谢提升错误跟踪器上的 Andysem ( https://svn.boost.org/trac/boost/ticket/8866 )。

于 2013-07-22T01:02:10.120 回答