31
General / Re: Can't get SFML on VS 2022
« on: February 08, 2024, 05:23:07 am »
Don't worry, it does get pretty confusing at the beginning. Visual Studio doesn't go out of its way to make it easier either (as we'll see soon).
SFML 32bit will be fine, as long as your project has the platform set to Win32/X86 instead of X64.
For the missing DLLs...
When the run a program, it looks in a few places for the dlls. One is the system path (set in Windows, every directory in the path will be searched). The other is the "working directory".
If you run a program by clicking on it in explorer, the working directory is set to the same directory as where the program is. So if you click on c:\game\main.exe, it will search c:\game for the dlls.
This is where VS is annoying.
Running a program from inside of Visual Studio uses a working directory set in the project properties. The default is $(ProjectDir), which means it will look for the dlls in the same directory as the .vcxproj file, not where the exe ended up!
I always change the working directory to $(TargetDir), that makes it look for dlls where the exe is.
The setting is in Debugging / Working Directory. If you set it to $(TargetDir) and copy the SFML dlls into the same directory as the exe file you built, it should hopefully work.
SFML 32bit will be fine, as long as your project has the platform set to Win32/X86 instead of X64.
For the missing DLLs...
When the run a program, it looks in a few places for the dlls. One is the system path (set in Windows, every directory in the path will be searched). The other is the "working directory".
If you run a program by clicking on it in explorer, the working directory is set to the same directory as where the program is. So if you click on c:\game\main.exe, it will search c:\game for the dlls.
This is where VS is annoying.
Running a program from inside of Visual Studio uses a working directory set in the project properties. The default is $(ProjectDir), which means it will look for the dlls in the same directory as the .vcxproj file, not where the exe ended up!
I always change the working directory to $(TargetDir), that makes it look for dlls where the exe is.
The setting is in Debugging / Working Directory. If you set it to $(TargetDir) and copy the SFML dlls into the same directory as the exe file you built, it should hopefully work.