Patricia
Patricia

Reputation: 5089

C++ Boost - Can't resolve namespace member or container

I'm trying to follow this Boost tutorial and cannot figure out why the namespace and containers are not recognized. I've looked and looked to no avail. Any help would be greatly appreciated.

enter image description here


Here is the code:

/**
 * Boost Logger Test
 */

#include <boost/log/core/core.hpp>

namespace logging = boost::log;
namespace expr = boost::log::expressions;
namespace sinks = boost::log::sinks;

enum severity_level
{
    normal,
    notification,
    warning,
    error,
    critical
};

void init()
{
    boost::shared_ptr< logging::core > core = logging::core::get();

    logging::add_file_log
            (
                    keywords::file_name = "sample_%N.log",
                    keywords::rotation_size = 10 * 1024 * 1024,
                    keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0),
                    keywords::format = "[%TimeStamp%]: %Message%"
            );

    logging::core::get()->set_filter
            (
                    logging::trivial::severity >= logging::trivial::info
            );
}

int main(int argc, char* argv[]) {
    init();
    return 0;
}

Upvotes: 0

Views: 2365

Answers (1)

vsoftco
vsoftco

Reputation: 56567

You must

#include <boost/log/utility/setup/file.hpp>
#include <boost/log/trivial.hpp> 

and add

namespace keywords = boost::log::keywords;

Upvotes: 3

Related Questions