Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Compiling Quake Using Visual C++ Express Edition Goto page 1, 2, 3 Next

| Inside3d Forums Forum Index -> Engine Programming

View previous topic :: View next topic
Author | Message
--- | ---
Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Tue Dec 02, 2008 7:25 pm Post subject: Compiling Quake Using Visual C++ Express Edition |

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.

Quote:
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 ...

Quote:

Code:
.\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.

Quote:
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.

Back to top |

metlslime Joined: 05 Feb 2008 Posts: 177 |

Posted: Tue Dec 02, 2008 9:22 pm Post subject: |

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

Back to top |

mh Joined: 12 Jan 2008 Posts: 910 |

Posted: Wed Dec 03, 2008 12:05 am Post subject: |

This is a good thing to have. 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.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines

Back to top |

metlslime Joined: 05 Feb 2008 Posts: 177 |

Posted: Thu Dec 11, 2008 9:57 am Post subject: |

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

Code:
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

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Thu Dec 11, 2008 6:31 pm Post subject: |

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

Code:
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.

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Tue Mar 31, 2009 6:46 am Post subject: |

my problem

Quote:
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 ==========

_________________
QuakeDB - Quake ModDB Group

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Tue Mar 31, 2009 8:01 am Post subject: |

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. _________________ What's a signature?

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Tue Mar 31, 2009 8:20 am Post subject: |

did that :/ still not good...

Quote:
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 ==========

_________________
QuakeDB - Quake ModDB Group

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Tue Mar 31, 2009 8:30 am Post subject: |

more successful though. I recommend that you install masm next, by the way. _________________ What's a signature?

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Tue Mar 31, 2009 8:33 am Post subject: |

well, got it working, it only compiles up glquake, oh and whats masm? _________________ QuakeDB - Quake ModDB Group

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Tue Mar 31, 2009 9:05 am Post subject: |

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). _________________ What's a signature?

Back to top |

Stroggos Joined: 14 Apr 2009 Posts: 43 |

Posted: Fri Apr 17, 2009 8:29 am Post subject: |

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

Quote:
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
_________________
Dont even try to port Quake 4 to the ipod

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Fri Apr 17, 2009 9:10 am Post subject: |

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.
_________________
What's a signature?

Back to top |

Stroggos Joined: 14 Apr 2009 Posts: 43 |

Posted: Fri Apr 17, 2009 10:05 am Post subject: |

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! _________________ Dont even try to port Quake 4 to the ipod

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Fri Apr 17, 2009 10:31 am Post subject: |

"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.
_________________
What's a signature?

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> Engine Programming | All times are GMT Goto page 1, 2, 3 Next
Page 1 of 3

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group