AMQP-CPP RabbitMQ 构建集成到 CPP 项目

AMQP-CPP RabbitMQ Build Integrating to CPP Project

您好,我目前正在尝试通过 AMQPCPP 将 RabbitMQ 集成到我的 VisualStudio 项目中。我只能使用 Windows PC,这对安装来说是一件很痛苦的事情。 我想我能够使用 CMAKE But I received some Error doing it . Now I am trying to include the build into the VS2017 Project. In the Readme https://github.com/CopernicaMarketingSoftware/AMQP-CPP 构建项目,这是使用

完成的
#include <amqpcpp.h>

但是在我的构建中找不到这个 header。我不习惯 CPP,所以我希望我没有犯一些基本错误。提前致谢!

在 Windows - Visual Studio 2017

中使用 CMake 构建 AMQP-CPP 的步骤

打开命令提示符并切换到 AMQP-CPP git/source 路径。

1) >mkdir 构建

2) >CD 构建

3) >cmake -G "Visual Studio 15 2017 Win64" ..\

    -- Selecting Windows SDK version 10.0.15063.0 to target Windows 6.1.7601.
    -- The C compiler identification is MSVC 19.10.25019.0
    -- The CXX compiler identification is MSVC 19.10.25019.0
    -- Check for working C compiler: E:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe
    -- Check for working C compiler: E:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: E:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe
    -- Check for working CXX compiler: E:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Configuring done
    -- Generating done
    -- Build files have been written to: D:/Projects/AMQP-CPP/build

4) >cmake --build 。 --target ALL_BUILD --config RELEASE --clean-first -- /m

构建成功。

   "D:\Projects\AMQP-CPP\build\ALL_BUILD.vcxproj" (default target) (1) ->       "D:\Projects\AMQP-CPP\build\amqpcpp.vcxproj" (default target) (3)        ->       (ClCompile target) ->
     D:\Projects\AMQP-CPP\src\deferredreceiver.cpp(48): warning C424
   4: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss o
   f data [D:\Projects\AMQP-CPP\build\amqpcpp.vcxproj]

1 Warning(s)
0 Error(s)

已用时间 00:00:44.16

如何在您的项目中包含 amqpcpp

编辑项目 CMakeLists.txt 文件以添加 amqpcpp 包含路径和库路径 linking。

    include_directories(../include)
    link_directories(../build/bin/Release)

Include 和 link 目录路径可能因您计算机中的实际位置而异。