Guide:Compiling VVVVVV on Windows with Visual Studio
This page is a guide to compiling VVVVVV on Windows with Visual Studio.
Windows and Visual Studio are chosen because most people use Windows, and most Windows users use Visual Studio.
Setting up Visual Studio
If you don't already have Visual Studio installed, then you will need to download it.
This guide assumes that you will download and install Visual Studio 2022 (the latest non-preview version).
To download Visual Studio:
- Go to the Visual Studio downloads page.
- Next to Visual Studio 2022, click Free download under Community.
VisualStudioSetup.exe
will be downloaded. Run it.- During installation, make sure to check the Desktop development with C++ workload, because VVVVVV is programmed in C++. You can uncheck everything else; they won't be needed.
By the way, Visual Studio 2022 (with the C++ stuff) will take up about 12 gigs on your disk (it gets worse with each version). So if you're almost out of disk space, make sure to clear it up before installing.
Also, you might be prompted to restart your computer before being able to use Visual Studio.
Once you have Visual Studio open, it will ask you to sign in with an account. You don't really have to for now, but if you don't, it considers you on a trial until you sign in with an account. When the trial expires, it will make you sign in with an account anyways. If you are advanced enough, you can extend the license expiration date indefinitely with the VSCELicense PowerShell module and avoid signing in.
Cloning VVVVVV
You will need to download VVVVVV.
"Cloning" just means downloading a repository, but with a mechanism to let you easily download updates to it later, without having to re-download everything all over again. It is recommended to clone the VVVVVV source code repository instead of merely downloading it.
Visual Studio lets you clone Git repositories directly from the app. Doing this also automatically creates a new project for you, too. How convenient!
From the Visual Studio welcome screen:
- Click on Clone a repository.
- Enter in
https://github.com/TerryCavanagh/VVVVVV
under Repository location. - Click Clone.
Downloading dependencies
You will need to download SDL 2.
Note that since VVVVVV 2.2, the game uses SDL 2. There are older versions of SDL (SDL 1.2), but you don't want to use those.
To download SDL:
- Go to the SDL download page.
- Under Assets, click on
SDL2-devel-2.26.4-VC.zip
to download it. - In Windows Explorer, right-click on the file, and click on Extract All....
- Click Extract.
- Inside the extracted folder, drag
SDL2-2.26.4
toC:\
.- You can put this folder anywhere you want, but the rest of this guide assumes you have it in
C:\
. If you have it somewhere else, then you will need to change all paths referencingC:\SDL2-2.26.4
accordingly.
- You can put this folder anywhere you want, but the rest of this guide assumes you have it in
Generating the VS Solution
You will need to generate the files used to compile the game. Visual Studio's build files are called "Solutions". No, I don't know why they call them that.
Doing this entails opening a command prompt.
- From the menu bar, click on Tools, then Command Line, then Developer Command Prompt.
- In the command prompt, type
cd desktop_version
. - Type
mkdir build
, thencd build
. - Then enter in this long command:
cmake -A Win32 -G "Visual Studio 17 2022" .. -DSDL2_INCLUDE_DIRS="C:\SDL2-2.26.4\include" -DSDL2_LIBRARIES="C:\SDL2-2.26.4\lib\x86\SDL2;C:\SDL2-2.26.4\lib\x86\SDL2main"
If you prefer to copy and paste, then after copying the above command, you can paste it in by right-clicking inside the command prompt.
- If your
SDL2-2.26.4
folder is not inC:\
, you will need to change the paths in this command. - If you didn't check Desktop development with C++ when installing Visual Studio, you'll get an error. [1]
- If you are using a Visual Studio version other than Visual Studio 2022, you will need to change the
-G
string to match your Visual Studio version. [2]
- If your
Compiling
Now you're finally ready to compile the game.
To compile:
- Navigate to the
build
folder underdesktop_version
in the Solution Explorer panel on the right side of the screen. - Double-click on
VVVVVV.sln
. - From the top menu bar, click on Build, then Build Solution. Visual Studio will attempt to compile the game.
If it fails with an error LNK1104 saying "cannot open file 'SDL2.obj'", you will need to re-run the
cmake
command in the previous section, but add.lib
to all thelib
paths ofSDL2
andSDL2main
, and try again.[3]Once you do this, there will be a prompt saying that "a file has been modified outside the environment". It's fine to click Ignore All, but if you're worried, you can click Reload All.
- If it fails saying that an SDL function was not found (
SDL_OpenURL
,SDL_zero
,SDL_zeroa
, or similar), then your SDL is too old.
If it succeeds, then you just compiled VVVVVV!
Running
To navigate to the VVVVVV.exe
:
- In the Solution Explorer panel, right-click on VVVVVV.
- Click on Open Folder in File Explorer.
- Open the
Debug
folder.- If you decided to compile in release mode, then you would open the
Release
folder instead.
- If you decided to compile in release mode, then you would open the
You will need to put a copy of data.zip
into the same folder as VVVVVV.exe
, either by grabbing it from Steam or from downloading them directly from the Make & Play page (click on [Desktop data file]).
Lastly, you also need the SDL 2 .dll
in the same folder as VVVVVV.exe
. Copy over C:\SDL2-2.26.4\lib\x86\SDL2.dll
(or wherever you put that folder) to the folder.
After that, running VVVVVV.exe
should just work!
- If you get an error dialogue saying "The application was unable to start correctly (0xc000007b)", that means you copied the 64-bit
SDL2.dll
instead of the 32-bit one. Copy theSDL2.dll
from thex86
folder and try again.
Notes
- ↑
The error will probably look like:
Generator Visual Studio 17 2022 could not find any instance of Visual Studio.
To fix this:
- Go back to Visual Studio.
- Click on Tools, then Get Tools and Features....
- If you still have the installer open, then it will bring you to the installer with a dialogue box saying that it's already open.
- If prompted, click Modify next to Visual Studio Community 2022.
- Check Desktop development with C++.
- Click Modify in the bottom-right.
- If you still have the VVVVVV project open, it will pop up a dialogue asking you to close the project. Just click Continue on that dialogue.
You might be prompted to restart your computer before being able to use Visual Studio.
- ↑
Change the string to the one matching your version in this list:
- VS 2010:
"Visual Studio 10 2010"
- VS 2012:
"Visual Studio 11 2012"
- VS 2013:
"Visual Studio 12 2013"
- VS 2015:
"Visual Studio 14 2015"
- VS 2017:
"Visual Studio 15 2017"
- VS 2019:
"Visual Studio 16 2019"
- VS 2022:
"Visual Studio 17 2022"
- VS 2010:
- ↑
Like so:
cmake -A Win32 -G "Visual Studio 17 2022" .. -DSDL2_INCLUDE_DIRS="C:\SDL2-2.26.4\include" -DSDL2_LIBRARIES="C:\SDL2-2.26.4\lib\x86\SDL2.lib;C:\SDL2-2.26.4\lib\x86\SDL2main.lib"