在项目中使用时增加日志错误

时间:2013-07-12 19:04:08

标签: c++ boost boost-log

我在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 ‘>’ 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>行,但仍无法编译。

任何人都知道到底发生了什么事?

1 个答案:

答案 0 :(得分:0)

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

另外,我必须在我的cpp文件中定义BOOST_LOG_DYN_LINK(以便我的应用程序可以动态链接Boost日志 - 我想我将它构建为共享库?我不知道为什么它不会只是单独使用静态链接或动态链接,但它没有。)

感谢Andysem关于增强错误跟踪器(https://svn.boost.org/trac/boost/ticket/8866)。