SFML community forums

Help => General => Topic started by: dramcryx on August 29, 2019, 05:14:36 pm

Title: Static linking problem with VS2019
Post by: dramcryx on August 29, 2019, 05:14:36 pm
Hi. I'm trying to static link prebuilt binaries using Visual Studio 2019 and it fails with undefined references type of LNK2019. It works with dynamic link (no "s" suffix) and the app runs okay with dlls provided.
The command I'm trying to build with is:
cl -EHsc main.cpp sfml-graphics-s.lib sfml-window-s.lib sfml-system-s.lib opengl32.lib freetype.lib winmm.lib gdi32.lib
This command is for building your example green circle.
Am I wrong in linkage order? It fails on linking the graphics package. Same command previously worked with MinGW's g++, of course with proper substitutions.

(click to show/hide)

UPD: -DSFML_STATIC makes no effect (even longer list of link fails)
Title: Re: Static linking problem with VS2019
Post by: G. on August 29, 2019, 05:23:51 pm
Link order doesn't matter with Visual Studio.
I don't see any prebuilt binaries for VS 2019 (https://www.sfml-dev.org/download/sfml/2.5.1/). The package you use must match your version of Visual Studio.
Also, don't forget to define SFML_STATIC, in case you didn't.
Title: Re: Static linking problem with VS2019
Post by: dramcryx on August 29, 2019, 05:25:34 pm
I agree that there's no prebuilt binaries for VS2019 but it doesn't really matter for dynamic linking then?