-
Notifications
You must be signed in to change notification settings - Fork 60
build_with_msvc6
To compile the source code for C&C Generals and Zero Hour, follow the steps outlined below. This process is still in the early stages of development, and ongoing efforts may lead to additional tools being compiled from the source code. The focus here is solely on compiling the main executable, which can then be placed into the game directory and used to start the game with the newly compiled binary.
This process utilizes the original compiler from the game's development era to ensure compatibility. The available source code specifically compiles zerohour.exe.
This guide is intended for software developers, starting from a beginner level. You should be able to write programs and execute them. Familiarity with command-line interfaces and configuring environment variables when necessary is required.
Even if you do not know C++, you should still be able to compile the source code. However, a basic understanding of how C++ is compiled is necessary. This includes knowing what the compiler and linker do, as well as being able to interpret error messages and troubleshoot them effectively.
Download the following binary and software and have them ready in a project folder.
Installation of tools and software that are needed for compilation.
- Download the portable Visual Studio 6 as ZIP file from GitHub.
- Extract the contents and put them in the default install folder.
- Installation folder:
C:\Program Files (x86)\Microsoft Visual Studio\
Alternatively you can use the VC6 setup from Archive.org
- Run the installer for CMake
- Keep the defaults during setup wizard
- Run the git installer
- Keep the defaults during setup wizard
Clone the code from TheSuperHackers
git clone https://github.com/TheSuperHackers/GeneralsGameCode.git
cd GeneralsGameCode
This steps you need to repeat every time after a reboot of your computer.
Execute the setup build environment script. In your cmd type this. (assuming default installation path)
"C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin\VCVARS32.bat"
<VS6_INSTALL_PATH>
: Where you have put your vs6 installation path.
<PROJECT_FOLDER>
: Where you have the source code project.
PATH
C:\<VS6_INSTALL_PATH>\VB98;
C:\<VS6_INSTALL_PATH>\VC98\Bin;
C:\<VS6_INSTALL_PATH>\VC98\Lib;
C:\<VS6_INSTALL_PATH>\VC98\Include;
C:\<VS6_INSTALL_PATH>\Common\tools;
C:\<VS6_INSTALL_PATH>\Common\MSDev98\Bin
Environment Variables
set LIB=C:\<VS6_INSTALL_PATH>\VC98\Lib;^
C:\<VS6_INSTALL_PATH>\VC98\MFC\Lib;^
C:\<PPROJECT_FOLDER>\build\vc6
set INCLUDE=C:\<VS6_INSTALL_PATH>\VC98\ATL\Include;^
C:\<VS6_INSTALL_PATH>\VC98\Include;^
C:\<VS6_INSTALL_PATH>\VC98\MFC\Include;^
C:\<VS6_INSTALL_PATH>\VC98\Include
set CC=C:\<VS6_INSTALL_PATH>\VC98\Bin\CL.exe
set CXX=C:\<VS6_INSTALL_PATH>\VC98\Bin\CL.exe
set MSVCDir=C:\<VS6_INSTALL_PATH>\VC98
Run the following command by the type of build you want to create.
-
cmake --workflow --preset vc6
for a release build. -
cmake --workflow --preset vc6dgb
for a debug build. -
cmake --workflow --preset vc6int
for an internal build. -
cmake --workflow --preset vc6prof
for a profile build.
You will find a bunch of files in build\vc6\<game name>
and a file called generalszh.exe
or generalsv.exe
.
Run cmake --install build\<vc6 build type>
, this will copy the executable to the retail game directory, or you can
copy it manually.
- The compiler failed because the total path length for lib and include exceeded the limit for VS6.
- Your only option is to move your project and dependencies closer to the root of your drive or rename folders in your project to shorter names.
- Ensure that you have correctly set up your
LIB
andINCLUDE
environment variables. - These variables are essential for linking and compiling header (
.h
) and library (.lib
) files.
- Delete the
build
folder and try again. - Sometimes, CMake's cache gets corrupted, and you need to start fresh.
- How to Get Involved
- How to Contribution
- Community forks
- License
- Credits
- Changelog
- FAQ
- Known Issues
- Contact & Community
-
Visual Studio 6 Guides:
-
Visual Studio 2022 Guides:
- DirectX
- STLport
- Max4SDK
- NVASM
- Benchmark
- MilesSoundSystem
- Bink
- SafeDisk
- Asimp3
- GameSpy
- ZLib
- LZHCompress