Compiling under VS2022

From Valve Developer Community
Jump to: navigation, search
English (en)
Edit
Icon-broom.png
This article or section should be converted to third person to conform to wiki standards.

Stub

This article or section is a stub. You can help by adding to it.

Note: Sorry that this article is a bit of a stub! I wanted to make sure it at least existed for those looking to use a modern compiler with the 2013 SDK. It is absolutely reasonable to use the latest compilers with the SDK! I would suggest using the diffs from the two GitHub repos linked on this page for figuring it out for your mod.


With Visual Studio 2013 becoming older harder to obtain, using Microsoft's (as of writing) actively supported and updated Visual Studio 2022 becomes a no-brainier. As it is not be the officially-supported IDE of the Source SDK, some work is required to get it all functioning.

This article is primarily based on these two GitHub repos

Running VPC

If you don't have an older version of Visual Studio on your computer, VPC will fail to run, as it can't find certain registry keys specific to these older versions.

The best solution is to go grab an edit of VPC that works for modern versions of Visual Studio. https://github.com/Joshua-Ashton/Source-PlusPlus/blob/master/src/devtools/bin/vpc.exe

Another solution would be to add the registry keys VPC is looking for.

Todo: Provide the registry keys needed here.

Once running the VPC scripts will need to be modified to support the newer toolsets.

Todo: Explain changes from here https://github.com/ozxybox/source-mp13-vs2022/tree/master/mp/src/vpc_scripts

Fixing particles.lib

Once everything's compiling, you'll hit a snag with particles.lib. It defines the symbol _hypot, and in VS 2022, that symbol is already getting used up.

The best solution for this is to go grab an edit of particles.lib that's been fixed. https://github.com/Joshua-Ashton/Source-PlusPlus/blob/master/src/lib/public/particles.lib

If you're not a fan of that idea, one alternative could be telling VPC to allow multiple symbols to exist for the client project. This is not a great practice though! https://github.com/ozxybox/source-mp13-vs2022/blob/7be91d3ddc4388ec43a60195f6d959682a256cbe/mp/src/game/client/client_base.vpc#L74

Fixing memoverride.cpp

The main file that needs to be fixed for Source to work under VS 2022 is memoverride.cpp.

Todo: Explain everything from here https://github.com/ozxybox/source-mp13-vs2022/blob/master/mp/src/public/tier0/memoverride.cpp