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})