• 编译AMQP-CPP


    1 cd  ./AMQP-CPP/examples/boost$

    2.cmake .

    提示boost版本太低,

    首先要编译生成boost安装工具bjam
    进入boost目录执行:
    ./bootstrap.sh
    然后执行刚生成的
    ./bjam -s HAVE_ICU=1
    编译开始,大约半小时,全部编译结束。
    ./bjam install --prefix=/usr


    3.make
    又报错,把日志输到文件中

    make -j4 2>~err

    发现是要设置C++11编译

    在CMakeLists.txt

    cmake_minimum_required(VERSION 3.2)

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

    cmake .

    make

    完毕。

    CMakeLists.txt

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    set(Boost_USE_STATIC_LIBS ON)
    set(Boost_USE_MULTITHREADED ON)  
    set(Boost_USE_STATIC_RUNTIME OFF) 
    find_package(Boost 1.55 REQUIRED COMPONENTS system)
    
    if(NOT Boost_FOUND)
        message( FATAL_ERROR "boost must be installed")
    endif()
    
    include_directories(${Boost_INCLUDE_DIRS})
    
    add_library(asio_handler asiohandler.cpp asiohandler.h)
    target_link_libraries(asio_handler ${Boost_LIBRARIES})
    
    set(PROGS send
              receive
              new_task
              worker
              emit_log
              receive_logs
              emit_log_direct
              receive_logs_direct
              emit_log_topic
              receive_logs_topic
              rpc_client
              rpc_server
    )
    
    
    find_package (Threads)
    
    foreach(item ${PROGS})
        add_executable(${item} "${item}.cpp")
        target_link_libraries(${item} amqp-cpp
                                      asio_handler
                                      ${CMAKE_THREAD_LIBS_INIT})    
    endforeach(item)
    
    #little hack
    file(GLOB AMQCPP_HEADERS ${PROJECT_SOURCE_DIR}/include/*)
    
    file(COPY ${AMQCPP_HEADERS}
         DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/amqpcpp)
    
    include_directories(${PROJECT_SOURCE_DIR}
                        ${CMAKE_CURRENT_BINARY_DIR})
         
    

      

  • 相关阅读:
    关于uoloadify不能显示效果原因(thinkphp5仿百度糯米)
    thinkphp3.2.3中$this->assign
    PDO
    类的声明 只能有属性和方法(属性没有括号,方法有括号)
    怎删改查
    JS鼠标事件大全
    建表以及 增。删。改。查
    建表、添加数据及数据查询
    html框架
    表的求和及计算
  • 原文地址:https://www.cnblogs.com/chunyou128/p/5238128.html
Copyright © 2020-2023  润新知