Is the static still not working?
As far as I understood, in 1.4.0 you fixed the installation of the static version via vcpkg... or not?
PS E:\Work\vcpkg> ./vcpkg search gamenetworkingsockets
gamenetworkingsockets 1.4.0 GameNetworkingSockets is a basic transport layer for games.
The result may be outdated. Run `git pull` to get the latest results.
If your port is not listed, please open an issue at and/or consider making a pull request:
https://github.com/Microsoft/vcpkg/issues
PS E:\Work\vcpkg> ./vcpkg install gamenetworkingsockets:x64-windows-static
Computing installation plan...
Error: gamenetworkingsockets[core] is only supported on '!(static & windows) & !uwp & !(arm64 & windows)'
I saw this PR [gamenetworkingsockets] Enable building as a static library, and add webrtc feature, it was not included in 1.4.0? Your PR 1.4.0 still does not support the static version. Why?
You can try with this vcpkg patch (also includes some physx stuff i'm working on): https://github.com/eddiejames/vcpkg/commit/420290091e82288e461473e3447e6e4901f0c8df
My original PR wasn't accepted because of webrtc stuff... I'll try and resubmit my change sometime
You can try with this vcpkg patch
I applied this patch, GNS compiled statically, but my project compiles with errors of unresolved external symbols.
error LNK2019: unresolved external symbol __imp_GameNetworkingSockets_Init referenced in function main
I have enabled the use of static vcpkg libraries in the project properties. I don't know why vcpkg didn't include the library in my project. Can this be done manually?
Okay, I solved this problem with a macro.
#define STEAMNETWORKINGSOCKETS_STATIC_LINK
But now there are the same errors in libcrypto.lib.
error LNK2019: unresolved external symbol __imp_DeregisterEventSource referenced in function OPENSSL_showfatal
error LNK2019: unresolved external symbol __imp_RegisterEventSourceW referenced in function OPENSSL_showfatal
error LNK2019: unresolved external symbol __imp_ReportEventW referenced in function OPENSSL_showfatal
...
If I can solve this problem too, I'll write.
I did it. Thank you for your patch. The problem I wrote about above is solved by using additional Windows API libraries.
#pragma comment(lib, "Advapi32.lib")
#pragma comment(lib, "User32.lib")
#pragma comment(lib, "Crypt32.lib")
It is also required to use the /MTd flag for Debug configuration and /MT for Release configuration.
Also a little warning, for those who will be switching to the static version. If you call GameNetworkingSocket_Init in the global object constructor, it may crash during static linking when it worked fine in the dynamic because of the different order of object initialization.
Static should be a preferred way to consume GameNetworkingSockets. Dll makes it easier for reverse engineers to hack your game. It would be nice if static linking was allowed with vcpkg.
I am also blocked on proper support for VCPKG_LIBRARY_LINKAGE static. I hope it is coming soon.