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

Author Topic: Unresolved external symbols in both sfml-window-s-d.lib and sfml-window-s.lib  (Read 584 times)

0 Members and 1 Guest are viewing this topic.

Bigeous Rateous

  • Newbie
  • *
  • Posts: 3
    • View Profile
This is my first time using this forum, so I've probably formatted something horribly wrong.

I'm trying to set up SFML 3 with static libraries in VS 2022, and keep getting 5 unresolved symbols in the window libraries no matter what I do. The code I have is just for the window with the green dot from the official "SFML and Visual Studio" tutorial.
This is the whole output:

Build started at 10:05 AM...
1>------ Build started: Project: ForReal, Configuration: Debug x64 ------
1>main.cpp
1>sfml-window-s-d.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp_wglCreateContext
1>sfml-window-s-d.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp_wglDeleteContext
1>sfml-window-s-d.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp_wglGetProcAddress
1>sfml-window-s-d.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp_wglMakeCurrent
1>sfml-window-s-d.lib(WglContext.obj) : error LNK2001: unresolved external symbol __imp_wglShareLists
1>C:\Users\aarin\source\repos\ForReal\x64\Debug\ForReal.exe : fatal error LNK1120: 5 unresolved externals
1>Done building project "ForReal.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 10:05 AM and took 02.255 seconds ==========

It's the same five errors in both debug and release (Using the non debug libraries for release).
My additional include and library directories are set to the right places on all configurations, the language is set to C++17, SFML_STATIC is in the Preprocessor Definition, and I'm using the correct set of libraries for debug and release as far as I know.
This is everything I have linked for debug:
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
sfml-system-s-d.lib
sfml-window-s-d.lib
sfml-graphics-s-d.lib
sfml-audio-s-d.lib
sfml-network-s-d.lib
ws2_32.lib
opengl32.lib
winmm.lib
freetyped.lib
FLACd.lib
oggd.lib
vorbisd.lib
vorbisencd.lib
vorbisfiled.lib

Maybe I've done something super obvious that I just looked over, or linked things in the wrong order or something. Any help would be really appreciated.
In the meantime I'm gonna see if I can get the previous version of SFML to work.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11110
    • View Profile
    • development blog
    • Email
The mentioned functions are all part of OpenGL and if you correctly link OpenGL32.lib they should be found.

Note that for the system libs like OpenGL you don't need to specify a path. Visual Studio will know where to find them.
Official FAQ: https://www.sfml-dev.org/faq/
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Bigeous Rateous

  • Newbie
  • *
  • Posts: 3
    • View Profile
Visual Studio will know where to find them.
Thanks! That got me a step ahead, at least.
I had an OpenGL32.lib that I had downloaded at some point and thrown into my lib folder, so whenever it was linking OpenGL, it was linking that and not the OpenGL lib hidden somewhere inside Visual Studio. With it linking the right one, I was able to get it running.

But, whenever I took the release exe and put it on an another (still x64) computer, it would crash after I opened it. Not sure why that is. I also tried adding System32 to the additional lib directories, and changing "opengl32.lib" to "opengl32.dll" in the additional dependencies, but I got a "LNK1107 invalid or corrupt file," so no luck with that either.
« Last Edit: January 23, 2025, 09:41:49 pm by Bigeous Rateous »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11110
    • View Profile
    • development blog
    • Email
Have you downloaded other such *.lib files?  ;D

What does the crash message say?
Official FAQ: https://www.sfml-dev.org/faq/
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Bigeous Rateous

  • Newbie
  • *
  • Posts: 3
    • View Profile
Have you downloaded other such *.lib files?  ;D

What does the crash message say?
The fishy OpenAL lib I downloaded seems to be working.

With the crash on the other computer, it would just open the console window then close after about three seconds. It did that with all of the SFML examples too. This was on an absolute husk of Windows 10 on a college campus library computer though, so I'm not worried about it. I was able to get my green dot to run on a more stable computer, so I guess everything here is resolved.
Thanks for the help!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11110
    • View Profile
    • development blog
    • Email
Hmm yeah on some library PC it might various things. :D

Glad it works now!
Official FAQ: https://www.sfml-dev.org/faq/
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/