简体   繁体   English

如何设置[ZeroMQ]以在Visual Studio 2015 Enterprise中使用?

[英]How to set up [ ZeroMQ ] for use in a Visual Studio 2015 Enterprise?

While my primary domain of expertise is not Visual Studio 2015 setup / project configuration, I have experienced troubles on loading / configuring ZeroMQ project. 虽然我的主要专业领域不是Visual Studio 2015安装/项目配置,但我在加载/配置ZeroMQ项目时遇到了麻烦。

How to proceed correctly on loading a ZeroMQ Project? 如何正确加载ZeroMQ项目?

Observed errors: 观察到的错误:

  • current build on github and even old "stable" versions cause cmake errors 当前构建在github上甚至旧的“稳定”版本都会导致cmake错误
  • ZeroMQ Installer does not support Visual Studio v14 ZeroMQ Installer不支持Visual Studio v14

Instructions would be awesome, as it seems that there is no other source of documentation for this situation on the internet. 说明会很棒,因为在互联网上似乎没有其他文件来源。

Had the same problem a while ago. 刚才有同样的问题。 Here is what I did to solve this: 以下是我为解决这个问题所做的工作:

Download the right ZMQ version 下载正确的ZMQ版本

The "download link" provided on the ZMQ website seems outdated. ZMQ网站上提供的“下载链接”似乎已经过时。 To really get the current version you would have to use Git: 要真正获得当前版本,您必须使用Git:

git clone https://github.com/zeromq/libzmq.git

Build with Visual Studio 2015 使用Visual Studio 2015构建

The repository comes with a pre-build Visual Studio project. 存储库附带预构建的Visual Studio项目。 You can find it in ...\\libzmq\\builds\\msvc . 您可以在...\\libzmq\\builds\\msvc找到它。 To build for Visual Studio 2015 cd into vs2015 and open libzmq.sln . 要将Visual Studio 2015 cd构建到vs2015并打开libzmq.sln

You can choose if you want to compile static or dynamic libraries: DynRelease or StaticRelease for either Win32 or x64. 您可以选择是否要编译静态库或动态库:Win32或x64的DynReleaseStaticRelease

After that, run Build > Build solution to compile everything. 之后,运行Build > Build solution来编译所有内容。


Setup project to use compiled libraries 安装项目以使用已编译的库

After you created your project, go to the project's properties: 创建项目后,转到项目的属性:

C++ > General > Additional Include Directories should point to the include path of the repository. C++ > General > Additional Include Directories应指向存储库的包含路径。 If you want to use C++ style some additional files have to be placed in this directory. 如果要使用C ++样式,则必须在此目录中放置一些其他文件 Alternatively you can take a look at https://github.com/zeromq/zmqpp . 或者,您可以查看https://github.com/zeromq/zmqpp

Linker > General > Additional Library Directories should point to the built libraries. Linker > General > Additional Library Directories应指向构建的库。 They should be located at ...\\libzmq\\bin\\x64\\Release\\v140\\dynamic\\ . 它们应位于...\\libzmq\\bin\\x64\\Release\\v140\\dynamic\\

Linker > Input > Additional Dependencies should contain the name of the library you want to use. Linker > Input > Additional Dependencies应包含要使用的库的名称。 The default should be libzmq.lib , otherwise you will find the name in the bin directory. 默认值应为libzmq.lib ,否则您将在bin目录中找到该名称。

The program depends on the libzmq.dll file you just built. 该程序取决于您刚刚构建的libzmq.dll文件。 This file has to be placed within your project's build directory. 该文件必须放在项目的构建目录中。 To achieve this, you can add the following command to Build Events > Post-Build Event > Command Line : 要实现此目的,您可以将以下命令添加到Build Events > Post-Build Event > Command Line

copy /Y "...\libzmq\bin\x64\Release\v140\dynamic\libzmq.dll" "$(OutDir)"

This will copy the .dll file to the destination directory on every build if it's missing. 如果缺少,则会将.dll文件复制到每个构建的目标目录中。


Hope this helps =) 希望这有助于=)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM