Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/138.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 包含记录器类时出错_C++_Logging_Boost_Compilation - Fatal编程技术网

C++ 包含记录器类时出错

C++ 包含记录器类时出错,c++,logging,boost,compilation,C++,Logging,Boost,Compilation,我尝试使用boostlog,我创建了一个简单的类 logger.hpp #ifndef LOGGER_H #define LOGGER_H //#define BOOST_ALL_DYN_LINK #include <string> #include <boost/log/core.hpp> #include <boost/log/trivial.hpp> #include <boost/log/expressions.hpp> #include

我尝试使用boostlog,我创建了一个简单的类 logger.hpp

#ifndef LOGGER_H
#define LOGGER_H

//#define BOOST_ALL_DYN_LINK
#include <string>
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sinks/text_file_backend.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/support/date_time.hpp>


#define MAX_FILE_SIZE 25*1024*1024

namespace logging = boost::log;
namespace attrs = boost::log::attributes;
namespace src = boost::log::sources;
namespace sinks = boost::log::sinks;
namespace expr = boost::log::expressions;
namespace keywords = boost::log::keywords;

class Logger {
    protected:
        void init();
    public:
        Logger();
        static void trace(std::string);
        static void debug(std::string);
        static void info(std::string);
        static void warning(std::string);
        static void error(std::string);
        static void fatal(std::string);
};
#endif

我不知道哪里有问题我的项目使用asio和cpp netlib库你能帮我吗?

看起来你正在使用Boost Spirit V2和Boost Phoenix V3(后者可能由Boost Log间接使用)

避免冲突以获得改进的Phoenix实现定义

#define BOOST_SPIRIT_USE_PHOENIX_V3

之前包括任何增强标题,或使用
-DBOOST\u SPIRIT\u USE\u PHOENIX\u V3

在您的帖子中,除了错误消息,您怎么能包括所有内容?请编辑带有错误消息的帖子。看起来您正在使用两个不同版本的BOOST。这可能最好发布在Boost讨论板上。
cmake_minimum_required(VERSION 2.8)
#Déclaration du projet
project(sgoauth)
#Define PATH
#Boost
set(BOOST_INCLUDEDIR /home/msouadji/lib/boost/include/)
set(BOOST_ROOT /home/msouadji/lib/boost/)
#Build Netlib
set ( CPP-NETLIB /home/msouadji/lib/cpp-netlib-fix-build )
#Placez vos exécutables dans des dossiers portant le nom du type de compilation
#(Release, Debug...).
set(EXECUTABLE_OUTPUT_PATH ./${CMAKE_BUILD_TYPE}/)
#include BOOST
set(Boost_USE_MULTITHREADED ON)
ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
set(Boost_COMPONENTS log thread date_time regex filesystem system log_setup REQUIRED)
find_package( Boost 1.53 REQUIRED ${Boost_COMPONENTS} )
find_package( OpenSSL )
include_directories(${Boost_INCLUDE_DIR})
#include CPP-NETLIB
set ( CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CPP-NETLIB} )
find_package ( cppnetlib 0.11.0 REQUIRED )
include_directories ( ${CPPNETLIB_INCLUDE_DIRS} )
#C++11
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
find_package( OpenSSL )
if (OPENSSL_FOUND)
    add_definitions(-DBOOST_NETWORK_ENABLE_HTTPS)
    include_directories(${OPENSSL_INCLUDE_DIR})
endif()

SET(source_files src/authloadconf.cpp src/authserver.cpp src/serverhandler.cpp
    src/authhandler.cpp  src/app.cpp src/httpclient.cpp src/httpsclient.cpp
    src/request.cpp src/nfcapphandler.cpp src/unixclient.cpp
    src/header/authexception.hpp src/logger.cpp)
#sgoauth
add_executable(sgoauth  ${source_files} src/sgoauth_main.cpp)
target_link_libraries ( sgoauth
    ${Boost_LIBRARIES}
    ${CMAKE_THREAD_LIBS_INIT}
    ${CPPNETLIB_LIBRARIES}
    pthread
    )

# quicktest
set(VAR httpclienttest  loggertest)
# loop over a, b,c with the variable f
foreach(exec ${VAR})
    add_executable(${exec}  ${source_files} src/quicktest/${exec}_main.cpp)
    TARGET_LINK_LIBRARIES ( ${exec}
        ${Boost_LIBRARIES}
        ${CMAKE_THREAD_LIBS_INIT}
        ${CPPNETLIB_LIBRARIES}
        pthread
        )
endforeach(exec) 
#define BOOST_SPIRIT_USE_PHOENIX_V3