Forum

Compiling Quake Using Visual C++ Express Edition

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Compiling Quake Using Visual C++ Express Edition

Postby Baker » Tue Dec 02, 2008 7:25 pm

Ok ...

I don't have a lot of faith in newer Microsoft products. So any comments, concerns, whatever are rather welcome.

Compiling Quake on Visual C++ Express Edition

Most people are using Windows and Visual C++ Express Edition is free (download)... weighing in at a hefty 1.2 GB after install.

For someone who doesn't know, the Quake engine -- winquake.exe, glquake.exe, etc. --- is written in C. Vanilla C.

Not C++, not C# and not QuakeC -- QuakeC is what the external game logic source for a progs.dat is written in.

The Future

If there are to be any future engine coders, it would be rather helpful if they can compile Quake in Visual C++ Express Edition.

If you can't compile, that sort of is a deal breaker.

Issues I encountered ... and dealt with

You can skip reading this. Addresses the issues with trying to compile and how I addressed them.

The project file further down below doesn't have any of these issues -- I addressed them.

1. I ended up copying my existing gas2masm.exe over into the new project folder. I had some small issue with that, I don't recall it being insurmountable but I'm still having trouble finding some stuff in Visual C++ Express because everything is somewhere else.

2. winquake.rc has #include "afxres.h" which is Googling tells me is an MFC file header and not meant/supposed to be using with Visual C++ Express Edition (reference thread), I opened up DarkPlaces source version of winquake.rc and used that as a model.

3. We get this when we try to compile ...

Code: Select all
.\net_wins.c(405) : error C2072: '_errno' : initialization of a function


And for whatever reason, changing the variable name from "errno" to "xerrno" solves the problem. (It appears errno is special global variable and such use makes compiler mad?) I remembered seeing the variable renamed in the Kurok source so I evaded the issue.


4. The linker complains about libc.lib. And Googling, it appears just going to project settings and telling the linker to ignore libc works. (Reference thread) (i.e. add "LIBC.lib" to Linker/Input/Ignore Specific Library)

5. After the above, everything compiles and runs.


The Downloads

Visual C++ Express Edition: download page

Entire project folder.zip: Quake Source Code - Visual C++ Express 2008 Project (compile ready)

example glquake.exe compiled with this: download

To compile:

1. Start Visual C++ Express Editor
2. Open the winquake.sln file by doing File->Open->Project/Solution
3. Press F7 to compile and it should compile as-is
4. The glquake.exe is in the "release_gl" folder.

Remember: there are several dozen things "wrong" with glquake, so if it runs funny like you get a white screen (add -no8bit to command line) or if it runs too fast or too slow (clock issue with dual core/quad core if you have one of those), it isn't the fault of the compiler.


Why isn't this in the tutorial section?

I'm going to improve and write a brief tutorial based on any feedback, post the quick and dirty downloads part with a link to this thread as a reference and add screenshots.
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby metlslime » Tue Dec 02, 2008 9:22 pm

you seemed to hit most of the problems from http://www.celephais.net/board/view_thread.php?id=60023 , excluding the ones caused by mistakes in fitzquake's project file.

For gas2masm, there may be a problem with the exe built in a different place than the custom build step expects to find it. (or maybe this was just a fitzquake project file thing.) Also, you need ml.exe, which is hard to find, though someone said it was available at http://www.masm32.com/

Actually, that reminds me of another good tutorial you could write: stripping out the remaining ASM code from glquake, since it's only used for a few functions, and causes general headaches for developers, and the performance benefit is negligible in modern times. And it's not portable. Sleepwalkr removed it from his FitzquakeSDL, and I have now done the same in my current codebase.
Last edited by metlslime on Thu Dec 11, 2008 9:46 am, edited 1 time in total.
metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Postby mh » Wed Dec 03, 2008 12:05 am

This is a good thing to have. :D

Other issues I found were errors owing to the fact that VC++ from 2005 on no longer supports the single-threaded C runtime. This means that your standard C runtime functions will now be running multi-threaded, which in turn means that if you have any usage of them that's not thread-safe you will crash and burn.

Let me know if you get any PF_VarString crashes under 2008 that you didn't get before, and what you did to fix them if so. ;)

Intellisense is horrible on 2005 and 2008 too; not that it's slow but more that it takes a long time to update it's database; add a new struct member and you'll be typing "." or "->" a few times before it shows up. (Turning off the Class View window seems to fix this, but in the absence of any official - or even semi-official - confirmation I'll continue to mistrust it...)

Otherwise, it's a very very nice environment and not having to pay a thing for it means that development is open to a lot more people. :D
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby metlslime » Thu Dec 11, 2008 9:57 am

regarding the renaming of errno to xerrno, I found this in your net_wipx.c, line 246:

Code: Select all
int xerrno = pWSAGetLastError();

if (xerrno == WSAEWOULDBLOCK || errno == WSAECONNREFUSED)
   return 0;


It looks like you want to change that last errno into xerrno too, to make it function as originally written.

Edit: also, same problem on line 405 of net_wins.c
metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Postby Baker » Thu Dec 11, 2008 6:31 pm

metlslime wrote:regarding the renaming of errno to xerrno, I found this in your net_wipx.c, line 246:

Code: Select all
int xerrno = pWSAGetLastError();

if (xerrno == WSAEWOULDBLOCK || errno == WSAECONNREFUSED)
   return 0;


It looks like you want to change that last errno into xerrno too, to make it function as originally written.

Edit: also, same problem on line 405 of net_wins.c


Thanks for pointing that out.

I've updated the download with the above 2 files corrected.
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby ceriux » Tue Mar 31, 2009 6:46 am

my problem

1>------ Build started: Project: winquake, Configuration: GL Release Win32 ------
1>mycoolbuild
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Documents
1>and
1>c1 : fatal error C1083: Cannot open source file: 'c:\Documents': No such file or directory
1>My
1>c1 : fatal error C1083: Cannot open source file: 'and': No such file or directory
1>sys_wina.s
1>c1 : fatal error C1083: Cannot open source file: 'Settings\Charles\My': No such file or directory
1>c1 : fatal error C1083: Cannot open source file: 'Documents\myquake\quake-visual_cpp_express_2008\sys_wina.s': No such file or directory
1> Assembling: .\release_gl\sys_wina.asm
1>Microsoft (R) Macro Assembler Version 9.00.30729.01
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 9.00.30729
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>BSCMAKE: error BK1506 : cannot open file '.\release_gl\chase.sbr': No such file or directory
1>Build log was saved at "file://c:\Documents and Settings\Charles\My Documents\myquake\quake-visual_cpp_express_2008\release_gl\BuildLog.htm"
1>winquake - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Spike » Tue Mar 31, 2009 8:01 am

looks like you need to add quotes somewhere...

Alternatively, move your source tree to some path that does not have spaces in it, and compile it from there.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby ceriux » Tue Mar 31, 2009 8:20 am

did that :/ still not good...


1>Generating Code...
1>c:\myquake\quake\gl_draw.c(148) : warning C4715: 'Scrap_AllocBlock' : not all control paths return a value
1>Compiling resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1>gl_refrag.obj : error LNK2019: unresolved external symbol _BoxOnPlaneSide referenced in function _R_SplitEntityOnNode
1>gl_rmain.obj : error LNK2001: unresolved external symbol _BoxOnPlaneSide
1>world.obj : error LNK2001: unresolved external symbol _BoxOnPlaneSide
1>snd_mix.obj : error LNK2019: unresolved external symbol _Snd_WriteLinearBlastStereo16 referenced in function _S_TransferStereo16
1>snd_mix.obj : error LNK2019: unresolved external symbol _SND_PaintChannelFrom8 referenced in function _S_PaintChannels
1>sys_win.obj : error LNK2019: unresolved external symbol _Sys_SetFPCW referenced in function _Sys_Init
1>sys_win.obj : error LNK2019: unresolved external symbol _MaskExceptions referenced in function _Sys_Init
1>sys_win.obj : error LNK2019: unresolved external symbol _Sys_PopFPCW referenced in function _Sys_FloatTime
1>sys_win.obj : error LNK2019: unresolved external symbol _Sys_PushFPCW_SetHigh referenced in function _Sys_FloatTime
1>world.obj : error LNK2019: unresolved external symbol _SV_HullPointContents referenced in function _SV_PointContents
1>.\release_gl\glquake.exe : fatal error LNK1120: 8 unresolved externals
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 9.00.30729
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://c:\myquake\quake\release_gl\BuildLog.htm"
1>winquake - 11 error(s), 3 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Spike » Tue Mar 31, 2009 8:30 am

more successful though.
I recommend that you install masm next, by the way.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby ceriux » Tue Mar 31, 2009 8:33 am

well, got it working, it only compiles up glquake, oh and whats masm?
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Spike » Tue Mar 31, 2009 9:05 am

masm = microsoft assembler
gas = gnu assembler
gas2masm = small app to read gnu assembler (at&t ordering) and convert it to something masm can understand (intel ordering).
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Stroggos » Fri Apr 17, 2009 8:29 am

what do i need to build this ive got the DirectX SDK is there anything else??? I keep getting errors and its really anoying HELP!!!

These Errors!!!
1>------ Build started: Project: winquake, Configuration: GL Release Win32 ------
1>mycoolbuild
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Documents
1>and
1>c1 : fatal error C1083: Cannot open source file: 'c:\Documents': No such file or directory
1>My
1>c1 : fatal error C1083: Cannot open source file: 'and': No such file or directory
1>sys_wina.s
1>c1 : fatal error C1083: Cannot open source file: 'Settings\Charles\My': No such file or directory
1>c1 : fatal error C1083: Cannot open source file: 'Documents\myquake\quake-visual_cpp_express_2008\sys_wina.s': No such file or directory
1> Assembling: .\release_gl\sys_wina.asm
1>Microsoft (R) Macro Assembler Version 9.00.30729.01
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 9.00.30729
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>BSCMAKE: error BK1506 : cannot open file '.\release_gl\chase.sbr': No such file or directory
1>Build log was saved at "file://c:\Documents and Settings\Charles\My Documents\myquake\quake-visual_cpp_express_2008\release_gl\BuildLog.htm"
1>winquake - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

and where do i add the quotes??? How do you get this working
Stroggos
 
Posts: 50
Joined: Tue Apr 14, 2009 11:40 am
Location: Australia

Postby Spike » Fri Apr 17, 2009 9:10 am

Easiest is for you to move your source tree out of documents and settings.
You can add quotes in the properties for the *.s files in your project.
Each such file has a source, a temporary file, and an output. You need about four sets of quotes per file I think.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Stroggos » Fri Apr 17, 2009 10:05 am

i know this is a really noob programmer question but what it a quote??? im very new to C and ive only been working with it for about two weeks!
Stroggos
 
Posts: 50
Joined: Tue Apr 14, 2009 11:40 am
Location: Australia

Postby Spike » Fri Apr 17, 2009 10:31 am

"this is a quote"

The term 'quote' may refer to the entirety, or when plural it may refer to the marks around such a quote (current or proposed). Depending on how lazy the author is.

Just add lots of " characters around filenames with spaces. grr.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Next

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest