schellingb / ZillaLib

Sleek multiplatform C++ 2D and 3D game creation!
https://zillalib.github.io/
zlib License
109 stars 8 forks source link

Is VC6 still supported? #17

Closed avelican closed 2 years ago

avelican commented 2 years ago

So I have been installing various ancient SDKs for the last 7 hours and I'm down to just 2 errors! SDL wants xinput.h from the DirectX 9 SDK. I read the last version of DX9 that works with VC6 is the Summer 2004 version, but it seems to be missing xinput.h. The 2010 version of the SDK does have it, but doesn't compile in VC6. Same story with dxgi.h.

Not sure where to go from here. Maybe my info was incorrect and I need a slightly newer DX9 SDK?

I'm fairly new to this sort of thing, so sorry if I missed something obvious.

schellingb commented 2 years ago

Hello and welcome!

Yes! VC6 is still supported, I can build and run the samples with it here.

I just downloaded the ZIP of this project and the ZIP of the game Hexzilla project, extracted them next to each other as directories "ZillaLib" and "Hexzilla", opened Hexzilla-vc6.dsw, changed the configuration to Win32 Debug and pressed "RUN" and it compiled and worked fine!

Edit: I misread "xinput.h" as "xaudio.h" and wrote an irrelevant response, here's the correct comment below.

I'm not sure why you are missing xaudio stuff though. The version of SDL2 included in the ZillaLib source code is a slimmed down version of SDL2 with only a few drivers enabled. On line 22 of SDL_config_zillalib.h which is included by SDL_config.h there is the following: #undef SDL_AUDIO_DRIVER_XAUDIO2 which should disable any xaudio stuff. And in the VC6 project file there is no mention of SDL_xaudio2.c so it shouldn't even try to compile that stuff. The DirectSound driver is the only one on Windows and for that one no DirectX SDK should be needed as all the headers are part of SDL.

Are you trying to build the full SDL2 library externally and use it with ZillaLib? I'm not sure how easy that is, I have never tried that...

Thanks for using ZillaLib and thanks for using VC6, it's a nice IDE :-)

avelican commented 2 years ago

I was using the project generator. Tried again with these zips, same two files missing: https://gist.github.com/avelican/3e7c181abc1ab6164a23bf0dba5f2756

...
...\zillalib\source\sdl\joystick\windows\sdl_dxjoystick_c.h(42) : fatal error C1083: Cannot open include file: 'xinput.h': No such file or directory
...
...\zillalib\source\sdl\video\windows\sdl_windowsvideo.c(250) : fatal error C1083: Cannot open include file: 'dxgi.h': No such file or directory
...

Update: A text search reveals these SDL files are included by ZillaLib-vc6.dsp. I tried removing them from the project file, but then I got complaints from SDL_video, SDL_windowsevents and SDL_joystick. Not sure how to proceed.

schellingb commented 2 years ago

Got you! Sorry for the first post, I somehow misread "xinput.h" as "xaudio.h" and then was completely off...

So it turns out 15 years or so ago when I installed VC6 I somehow installed a "Windows SDK 6.0A" and set the include/library directories in Visual C++ 6 to use it. That SDK includes "xinput.h" and "dxgi.h" which compiles with VC6. Now I couldn't find that SDK 6.0A for download anymore (apparently it was part of Visual Studio 2008) but I found this thread which mentioned that the 6.1 SDK is a minor upgrade of 6.0A so that could maybe work.

I ended up a rabbit hole trying to find one of these old Windows SDK's publicly for download and I found "6.0.6001.18000.367-KRMSDK_EN.iso" on the web archive which contains the 6.1 SDK. I didn't want to run the original installer due to worrying it would break one of my existing working installations of Visual Studio so I extracted some cab files and renamed every file to their original file name and placed them into an "Include" and "Lib" directory. And VC6 didn't want to compile with them...

So I search some more and find "6.1.6000.16384.10.WindowsSDK_Vista_Feb2007Update_rtm.DVD.Rel.iso" on Microsoft's site still available which has the 6.0A SDK! So I created an V6.0A\Include directory and extract these cabs into it

Then I created V6.0A\Lib and extracted these cabs into it

I renamed all files from <NAME>_<EXT>.<GUID> to <NAME>.<EXT> using the excellent Siren file renaming tool, set the Include and Lib directories as the top entry in the VC6 directories options and ... it compiles again! But with some warnings... So I added this on top of WinNT.h (after #define _WINNT_):

#if (defined(_MSC_VER))
#if (_MSC_VER < 1300)
//VC6 pops warnings with new Windows SDK headers
#pragma warning (disable : 4035)
#endif
#endif

and also this on top of WinGDI.h (after #define _WINGDI_):

#if (defined(_MSC_VER))
#if (_MSC_VER < 1300)
//VC6 pops warnings with new Windows SDK headers
#pragma warning (disable : 4068)
#endif
#endif

and VC6 is happy again. To spare you the annoyance of doing all that, here's that VC6 compatible V6.0A SDK for download: Windows_SDK_V6.0A_for_VC6.zip

Just extract it somewhere (i.e. C:\Program Files\Microsoft SDKs\Windows\V6.0A), open the Options window in VC6, go to Directories and add the V6.0A\Include path to the top of the list of Include files and the V6.0A\Lib path to the top of Library files.

Hopefully this resolves your problems :-)

avelican commented 2 years ago

Hey, thanks so much! I got Hexzilla to build and run with the zip you provided. Like you said the order of the includes is important, I had to put the V6.0A include above the VC98 include, otherwise it includes headers it can't compile.

For completeness sake, here's what I have now:

includes
C:\Program Files (x86)\Microsoft SDKs\Windows\V6.0A\Include
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE

libs
C:\Program Files (x86)\Microsoft SDKs\Windows\V6.0A\Lib
C:\Program Files (x86)\Microsoft Visual Studio\VC98\LIB

I removed MFC, ATL, DX9 and February 2003 Platform SDK, and it still builds fine! Thanks again :)