Compiling under VS2022: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:




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 [[Wikipedia:Integrated development environment|IDE]] of the Source SDK, some work is required to get it all functioning.  
With Visual Studio 2013 becoming older and harder to obtain, using Microsoft's (as of writing) actively supported and updated Visual Studio 2022 becomes a no-brainer. As it is not a officially-supported {{Wiki|Integrated development environment}} in eyes of the Source SDK, some work is required to get it all functioning.  


This article is primarily based on these two GitHub repos
This article is primarily based on these two GitHub repos
* https://github.com/ozxybox/source-mp13-vs2022
* https://github.com/ozxybox/source-mp13-vs2022
* https://github.com/Joshua-Ashton/Source-PlusPlus
* https://github.com/Joshua-Ashton/Source-PlusPlus
== I'm starting from scratch! ==
If you don't want to deal with setting up the project, or if you have problems compiling the source code because of certain errors, you can clone [https://github.com/ozxybox/source-mp13-vs2022 this repo] since it's based on the official repo and has minimal changes, just to make it run without problems. Please disregard any "compile process successful but file not found" warning as it is meaningless.


== Running VPC ==
== Running VPC ==
Line 15: Line 19:


The best solution is to go grab an edit of VPC that works for modern versions of Visual Studio.
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
[https://github.com/Joshua-Ashton/Source-PlusPlus/blob/master/src/devtools/bin/vpc.exe| Such as this one]


Another solution would be to add the registry keys VPC is looking for.
Another solution would be to add the registry keys VPC is looking for.
Line 23: Line 27:
{{Todo|Explain changes from here https://github.com/ozxybox/source-mp13-vs2022/tree/master/mp/src/vpc_scripts}}
{{Todo|Explain changes from here https://github.com/ozxybox/source-mp13-vs2022/tree/master/mp/src/vpc_scripts}}


== Fixing particles.lib ==
== Fixing <code>particles.lib</code> ==


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.  
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.
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
[https://github.com/Joshua-Ashton/Source-PlusPlus/blob/master/src/lib/public/particles.lib| (Like this one)]


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!
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
[https://github.com/ozxybox/source-mp13-vs2022/blob/7be91d3ddc4388ec43a60195f6d959682a256cbe/mp/src/game/client/client_base.vpc#L74| Example]


== Fixing '''memoverride.cpp''' ==
== Fixing <code>memoverride.cpp</code> ==


The main file that needs to be fixed for Source to work under VS 2022 is '''memoverride.cpp'''.
The main file that needs to be fixed for Source to work under VS 2022 is '''memoverride.cpp'''.
Line 41: Line 45:
== In Recap ==
== In Recap ==


Do what [[Source_SDK_2013|this page]] asks you to do while ignoring any reference to Visual Studio 2013, fix the Registry keys problem with the fix from the same page, download '''particles.lib''' to <code><mp or sp>\src\lib\public</code> from [https://github.com/Joshua-Ashton/Source-PlusPlus/blob/master/src/lib/public/particles.lib this], and finally, replace '''memoverride.cpp''' located at <code><mp or sp>\src\public\tier0</code> with [https://github.com/ozxybox/source-mp13-vs2022/blob/master/mp/src/public/tier0/memoverride.cpp this one]. Have fun making Source mods with updated software ;).
Do what [[Source_SDK_2013|this page]] asks you to do while ignoring any reference to Visual Studio 2013, fix the Registry keys problem with the fix from the same page, download '''particles.lib''' to <code><mp or sp>\src\lib\public</code> from [https://github.com/Joshua-Ashton/Source-PlusPlus/blob/master/src/lib/public/particles.lib this], and finally, replace '''memoverride.cpp''' located at <code><mp or sp>\src\public\tier0</code> with [https://github.com/ozxybox/source-mp13-vs2022/blob/master/mp/src/public/tier0/memoverride.cpp this one]. Have fun making Source mods with updated software ;)
 
==If all else fails==
 
If you still have problems compiling the source code because of certain errors, {{Note|As I, Golden Star, did}} you can clone [https://github.com/ozxybox/source-mp13-vs2022 this repo] since it's based on the official repo and has minimal changes, just to make it run without problems. Please disreguard any "compile proccess successeful but file not found" warning as it is meaningless.

Revision as of 12:42, 9 November 2023

English (en)Translate (Translate)

Stub

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

Note.pngNote: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 and harder to obtain, using Microsoft's (as of writing) actively supported and updated Visual Studio 2022 becomes a no-brainer. As it is not a officially-supported Wikipedia icon Integrated development environment in eyes of the Source SDK, some work is required to get it all functioning.

This article is primarily based on these two GitHub repos

I'm starting from scratch!

If you don't want to deal with setting up the project, or if you have problems compiling the source code because of certain errors, you can clone this repo since it's based on the official repo and has minimal changes, just to make it run without problems. Please disregard any "compile process successful but file not found" warning as it is meaningless.

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. Such as this one

Another solution would be to add the registry keys VPC is looking for. You can follow this fix.

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. (Like this one)

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! Example

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

In Recap

Do what this page asks you to do while ignoring any reference to Visual Studio 2013, fix the Registry keys problem with the fix from the same page, download particles.lib to <mp or sp>\src\lib\public from this, and finally, replace memoverride.cpp located at <mp or sp>\src\public\tier0 with this one. Have fun making Source mods with updated software ;)