This is a tutorial based on the technologies required for the related courses of C++ for aueb.gr (x64, windows setup).
For this course, we would use the Simple Game Library and C++ to develop an enhanced SDL application. Since we are using Windows in this tutorial, most steps are straightforward. The only handicap is that the scripts of compilation at the github repository are not well written and error messages are misleading. Error handling is pretty bad and if something goes wrong you end up with contradictory messages.
The main problem though is that the path of the Visual Studio is hard-coded which means that if you are not using the default installation locations the setup will fail. The error messages are not very helpful (they only report that the visual studio is not installed) so a newbie can easily be confused.
Lets get started.
Remove previous VS installations
If you have older installations of Visual Studio and you are not using them use the windows application installer (appwiz.cpl) to uninstall them.
If the normal installer fails, you can use a custom uninstaller at this github repository.
Install VS Community edition
You need to install a compatible version of VS with SGG.
In order to find the latest supported version of Visual Studio Community for the SGG you can either check for the comments of last commit for the installation scripts (e.g. look up for the comments of build_sgg_x64.bat) at the github repository or you can check the script source code.
The installation is pretty straightforward for Visual Studio so no further instructions are included in this article.
Preferably reboot your system after installation.
Install Simple Game Graphics library
Download the library from the official github link and extract to any directory of your choice.
If you have installed VS at the default locations you can simply run the script for your architecture (e.g. build_sgg_x64.bat). Hopefully it will run. There are some things that can go wrong. Check troubleshooting section for some of those cases.
If not, you need to edit the file manually. The fastest way is to remove all the IF EXISTS statements of the scripts and replace with your custom paths.
set STUDIO_VERSION=2022 set STUDIO_EDITION=Community set STUDIO_PATH=e:\_ProgramFilesSlow\vs2022 echo Compiling with Visual Studio %STUDIO_VERSION% %STUDIO_EDITION% ...
Repeat for the demo and run them.
Once the library has been compiled you will have the following files at the lib directory:
These are the files you need to link to when creating the new project.
Create a new project
cl not found
In order for the build scripts to run, the environment variables need to be setup correctly for x64 compilation. The default command prompt does not do that.
You need to open “x64 native tools command prompt” from the windows menu and run the build scripts from it.
For more read here.
msvcp140d.dll is not found
If you get a similar message then you need to install older versions of the build tools than the version of the Visual studio you have installed.
Run the Visual Studio Installer and be careful on the choices you are given. Normally it will ask you to select which modules you will install. From that menu select the proper version of the build tools and install it.
It’s recommended to reboot afterwards.