Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Static linking problem with VS2019  (Read 85 times)

0 Members and 1 Guest are viewing this topic.

dramcryx

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Static linking problem with VS2019
« 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)
« Last Edit: August 29, 2019, 05:22:52 pm by dramcryx »

G.

  • Hero Member
  • *****
  • Posts: 1396
    • View Profile
Re: Static linking problem with VS2019
« Reply #1 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. The package you use must match your version of Visual Studio.
Also, don't forget to define SFML_STATIC, in case you didn't.

dramcryx

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Static linking problem with VS2019
« Reply #2 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?