SFML community forums
Help => General => Topic started by: metafurionx on January 01, 2017, 02:14:47 am
-
I want to create a C++/SFML game that runs in Windows XP and doesn't ask the user for MSVCP140.dll.
I'm using SFML 2.4.1 for Windows (Visual C++ 14 (2015) - 32-bit) with Microsoft Visual Studio Community 2015.
I'm working in Windows 10 and using Windows XP in a virtual machine to test this.
I tried to ship whatever it needs with the program, but at some point it asks for something that isn't a file.
Then I believe I have to make it a static-library project.
So I followed the tutorial for SFML 2.4 and Visual Studio (http://www.sfml-dev.org/tutorials/2.4/start-vc.php).
Reproducing my steps adapted to the case:
I open Visual Studio > New Project > C++ (.NET Framework 4.5.2) > Win32 Console Application > name it "test" > check "Empty project" > click Finish
Create a "main.cpp" inside "Source Files" branch
Put "SFML-2.4.1" folder into "C:\"
Open the Property window for my project
Set Configuration to "All Configurations"
General > Platform Toolset > Visual Studio 2015 - Windows XP (v140_xp)
C/C++ > General > Additional Include Directiories > "C:\SFML-2.4.1\include"
Linker > General > Additional Library Directiories > "C:\SFML-2.4.1\lib"
Set Configuration to "Debug"
C/C++ > Preprocessor > Preprocessor Definitions > prepend "SFML_STATIC;"
C/C++ > Code Generation > Runtime Library > Multi-threaded Debug (/MTd)
Linker > Input > Additional Dependencies > prepend "sfml-graphics-s-d.lib;sfml-window-s-d.lib;sfml-system-s-d.lib;"
Set Configuration to "Release"
C/C++ > Preprocessor > Preprocessor Definitions > prepend "SFML_STATIC;"
C/C++ > Code Generation > Runtime Library > Multi-threaded (/MT)
Linker > Input > Additional Dependencies > prepend "sfml-graphics-s.lib;sfml-window-s.lib;sfml-system-s.lib;"
Then I go back to the project, copy the code from the tutorial to "main.cpp" and try to run Build Solution.
Debug (x86): 171 Errors and 87 Warnings
First error: LNK2038 mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in main.obj
Release (x86): 105 Errors and 1 Warning
First error: LNK2038 mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
I thought I did everything needed for a static-library project, but something is still dynamic. I don't know what to do from here. Please, help?
-
The SFML libraries have been.built with /MD and /MDd. If you want them to use /MT and /MTs, you'll have to rebuild SFML yourself and make sure to check UST_STATIC_STD_LIBS in the CMake option.
-
Oops, I have to set static libraries on Visual Studio's side, not SFML's.
Yeah, gotta do that (http://www.sfml-dev.org/tutorials/2.4/compile-with-cmake.php).
-
...And I did it! I followed the tut0r1al carefully, checked SFML_USE_STATIC_STD_LIBS but also unchecked BUILD_SHARED_LIBS.
I can't believe it. My game (C++14, SFML 2.4.1) is now a single .exe that runs on Windows XP or newer without the need to install any crap! It's beautiful. :'D
Thanks.