-1

I am trying to start a ZeroMQ developing in c++, using Visual Studio 2017, I've just downloaded libzmq-vc141.4.2.2, using NuGet,
but when I try to run the program I receive:

Error LNK2019 unresolved external symbol __imp__zmq_ctx_new referenced in function _main ZMQ C:\Users\Ledx\Documents\Visual Studio 2017\Projects\ZMQ\ZMQ\main.obj 1

In gcc you write -lzmq for linking, but what to do in Visual Studio?

Ledx
  • 21
  • 6
  • 1
    _"but in visual studio?"_ I don't know. It has a manual that you can read, doesn't it? Possible duplicate of [How to include libraries in Visual Studio 2012?](https://stackoverflow.com/questions/20058864/how-to-include-libraries-in-visual-studio-2012) – underscore_d Nov 21 '17 at 11:07
  • Did you set the lib path? – Jimmy Guo Nov 21 '17 at 11:07
  • well, i can do that if zmq is in external library but in this case im asking about nuget usage – Ledx Nov 21 '17 at 18:32

2 Answers2

1

Usually NuGet packages should take care of setting include and library dependencies via a .props or .targets file referenced in your .vcxproj project file.
You may open your .vcxproj file (with a text editor, as this kind of information are usually not accessible through Visual Studio IDE GUI) and check (nuget references are usually at the bottom of the project file.

Also, you can look in the "your_project\packages" directory and check if the libzmq-141.4.2.2 directory contains (at any level) a .props or .targets file.

If none of the above is true, either the Nuget package is not complete (then you may want to contact its publisher/author) or the package author explicitly decided to demand the include/library linking management to you, the Nuget package user (gross, but it may happen).

roalz
  • 2,699
  • 3
  • 25
  • 42
0

Using vcpkg takes care of everything. zmq can be used in projects without the need to set anything.

Commands....
vcpkg install cppzmq
vcpkg integrate install

Aftershock
  • 5,205
  • 4
  • 51
  • 64