Closed tzehetner closed 3 years ago
These not found symbols are in the library ws2_32.lib
provided by Windows. Since vcpkg does not actively add these system libraries to the import library list, you need to manually add it to the list.
Thanks.
Thanks for your reply.
Of course I understand, that I could add them, but it's an empty project that doesn't use anything from ws2_32.lib.
The thing is, that activating user-wide integration breaks compilation of C++/CLI projects, that don't even use packages from vcpkg. The empty C++/CLI project doesn't reference the grpc package and therefore shouldn't require ws2_32.lib.
To me this looks like a bug. It makes user-wide integration useless, because when I activate it, I cannot build certain projects.
And it's weird, that including the <array>
header influences the situation.
Or did I miss something? I am not really an MSVC and C++/CLI expert.
@strega-nil Could you please have a look?
Thanks.
I can confirm tzehetner's issue: Even a minimal "hello world" project with compiler option "/clr" (C++/CLI) fails with error LNK2001 whenever vcpkg is installed. Same project builds fine after "vcpkg integrate remove". I am very interested in a fix!
integrate install
effectively adds all the .lib
s you install with vcpkg to the linker command line; under normal operation the linker doesn't care about symbols in unreferenced .objs from libs.
If you add
<VcpkgAutoLink>false</VcpkgAutoLink>
to a <PropertyGroup>
in the affected project does the problem go away? (I'm suggesting that is the ultimate fix, just trying to confirm that this is the cause)
We probably want to turn off VcpkgAutoLink
by default when in a C++/CLI project. However, I'm not really sure how to do that... I'll look into this.
Wanted to let you know, that I upgraded to the latest version of Vcpkg today, and the problem disappeard. I did not add <VcpkgAutoLink>false</VcpkgAutoLink>
.
That is weird, thanks for updating us @tzehetner
This issue could repro locally, thanks @lken274 for sharing a workaround https://github.com/microsoft/vcpkg/issues/18021#issuecomment-845753087.
I can't repro this issue now, It seems to be fixed. Please reopen this issue if you encounter the issue again.
Environment
To Reproduce
#include <array>
Expected behavior Project builds.
Actual behavior Build fails with linker errors regarding grpc package and Winsock DLL, although the project doesn't use any of those libraries.
Failure logs
Additional context If for example the vector header is included instead of the array header, the project builds without problems.