libzmq.lib(tcp_address.obj) : error LNK2019: unresolved external symbol

Created on 5 May 2018  路  13Comments  路  Source: zeromq/libzmq

Issue description

Attempting to compile libzmq source on windows results in multiple linking errors regardless of the configuration used. I added a the libzmq/include directory as a additional include directory for the project.

Environment

  • libzmq version (commit hash if unreleased): current master (https://github.com/zeromq/libzmq/commit/363fa7892d43fe6e78339f7d7c5a0460167d3f6b)
  • OS: Windows 10 with msvc15

Minimal test code / Steps to reproduce the issue

  1. git clone the libzmq source into a directory
  2. open the libzmq\builds\msvc\vs2017\libzmq.sln in MSVS 2017
  3. Libzmq project properties -> Include Directories <>\libzmq\include;$(IncludePath)
  4. Attempt to compile. (Similar outputs on most configurations (Static/Dynamic) (Debug/Release))

What's the actual result? (include assertion message & call stack if applicable)

Output Log: StaticDebug https://pastebin.com/TXkyujRw
Output Log: StaticRelease https://pastebin.com/8sxBjwxX
Output Log: DynamicDebug https://pastebin.com/CAY16CFB
Output Log: DynamicRelease https://pastebin.com/JkZ4F8US

What's the expected result?

Program should compile

What am I doing wrong?

Most helpful comment

There are new files:

src/ip_resolver.cpp
src/ip_resolver.hpp

Perhaps those are missing?

All 13 comments

Unfortunately, there is no CI for the checked in sln files, so they tend to break. The cmake build is fine. Could you use that?

add tcp_address.hpp and tcp_address.cpp into sloution can slove this problem.
build MSVC files not updated.

Can you please send a PR to update the solutions?

Both files are in the solution in the libzmq project when I open it from Visual Studio. I saw from this blog, that it was possible to build libzmq with VS2015 earlier this year, so I checked out commit: 8e8009ec5d55b11945fe2a8c12c1a3bdf12c4686 and I was able to build with that, so something must've changed since that commit that is messing up VS2015?

There are new files:

src/ip_resolver.cpp
src/ip_resolver.hpp

Perhaps those are missing?

Yes, that was it. After adding them in the solution I can now build correctly. I have only tested it with VS 2015, so I will only change that solution. But I would expect the same diff to work for other versions.

@bluca I think we either

  • need CI for these checked-in solution files (for all supported VS versions),
  • declare them explicitly as unsupported but still accept PRs fixing them, or
  • declare them explicitly as unsupported, stop fixing them, and remove them in a timely manner.
    I strongly urge to pursue the latter option.

I don't think it is justified to have this, it poses a significant maintenance effort, but no benefit on the other hand. I don't see why someone shouldn't be able to use the cmake build when building with VS. Probably the majority of users are either unaware of the option to use the cmake build, when they see the checked-in solution files, or are unsure which ones are preferred.

Anyone wanting to develop libzmq actively cannot use the checked-in solution files as of today, since they do not contain any tests.

@jorikcaljouw could you please send a PR?

@sigiesec I have no opinion on these solutions - can't recall why they were added in the first place.

@bluca The checked-in solution files predate the CMake build. The former were in 2009 added with https://github.com/zeromq/libzmq/commit/f895426c1885729f4a4a20b1eb543a92915aed85, the latter in 2012 with https://github.com/zeromq/libzmq/commit/58f7c2179f2db84a87b734d6262ed3bbae342346.

I have a branch on my forked repo, but am having some issues with (I guess) line endings. I only changed the vcxproj file, but in the diff it shows many more diffs: https://github.com/zeromq/libzmq/compare/master...jorikcaljouw:fix_vs2015_solution. As a result I haven't created the PR yet.

If CMake is newer and recommended, maybe it's better to remove the msvc solutions all together instead of this fix. I only used it, since it was referenced on the blog article and it seemed valid to use.

Just do a git add -p path/to/solution instead of add -A or commit -a

This issue occurred in VS 2017 Edition I think. Also I do feel the issues were with
src/ip_resolver.cpp
src/ip_resolver.hpp
Thanks!

Yes, the vs2017 solution files are missing the references to the same files.

Since I was having other issues with my vs2017 I could change and verify it. I actually found this issue, because I was having the exact same linker issue when using vs2015.

Was this page helpful?
0 / 5 - 0 ratings