我使用mingw-4.7在Windows 7下从svn成功下载并编译了boost.log源代码。 IDE:eclipse-juno与CDT。
整个boost-sources的编译字符串(包括相应文件夹中的boost.log)是:
“bjam --build-type = complete mc-compiler = windmc”
作为输出,我收到了“ libboost_log-mgw47-1_51”和“libboost_log_setup-mgw47-mt-1_51 ”。
但是,从下面的boost.log文档中运行简单的示例代码时,我看不到任何输出。
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/init/to_console.hpp>
#include <iostream>
using namespace boost::log;
int main(int argc,
const char* argv[]) {
init_log_to_file();
BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
BOOST_LOG_TRIVIAL(info) << "An informational severity message";
BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
BOOST_LOG_TRIVIAL(error) << "An error severity message";
BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
return 0;
}
同样适用于以下代码剪切:
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/init/to_console.hpp>
#include <boost/log/utility/init/to_file.hpp>
#include <iostream>
using namespace boost::log;
int main(int argc,
const char* argv[]) {
init_log_to_file("sample.log");
BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
BOOST_LOG_TRIVIAL(info) << "An informational severity message";
BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
BOOST_LOG_TRIVIAL(error) << "An error severity message";
BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
return 0;
}
有人可以给我一个提示,为什么我在控制台上什么也看不见?
提前多多感谢,
Degoah