Discussion:
Compiling Quake 2
(too old to reply)
Ariena
2009-08-21 20:38:55 UTC
Permalink
Hi all,
Not sure if this is a good place to ask, but I figured it was worth a shot.
I'm trying to compile the Quake 2 source but can't figure it out. I tried
using "The arts of Q2 DLL coding"
(http://www.quake2.com/dll/tutorials/art/q2art1.html), but couldn't get it
to work. Seeing as though the tutorial is a decade old and I'm running
Vista, I'm thinking there may be some compatibility issues. At any rate, I
couldn't get lcc-win32 to compile the dll. I also have jGrasp on my
computer and tried to compile using that, but that also failed.
I tried another tutorial
(http://www.quake2.com/dll/tutorials/lcc/index.html) which seemed almost
successful, but ended with the errors:

g_cmds.obj .text: undefined reference to '_ChaseNext'
g_cmds.obj .text: undefined reference to '_ChasePrev'
g_main.obj .text: undefined reference to '_ServerCommand'
p_client.obj .text: undefined reference to '_SV_FilterPacket'
p_client.obj .text: undefined reference to '_GetChaseTarget'
p_client.obj .text: undefined reference to '_UpdateChaseCam'
make: Error code 8
make: 'gamex86.dll' removed.

Are these programming errors, i.e., I need to update function names in my
makefile or game.def? Or is there a different way to compile Quake 2
source? I have programming experience (Java, Python, PHP, etc), although I
am new to C / C++ and using makefiles, so you can throw geek-speak at me :)
Thanks in advance!

-- Ariena
Geoff
2009-08-23 04:22:36 UTC
Permalink
Post by Ariena
Hi all,
Not sure if this is a good place to ask, but I figured it was worth a shot.
I'm trying to compile the Quake 2 source but can't figure it out. I tried
using "The arts of Q2 DLL coding"
(http://www.quake2.com/dll/tutorials/art/q2art1.html), but couldn't get it
to work. Seeing as though the tutorial is a decade old and I'm running
Vista, I'm thinking there may be some compatibility issues. At any rate, I
couldn't get lcc-win32 to compile the dll. I also have jGrasp on my
computer and tried to compile using that, but that also failed.
I tried another tutorial
(http://www.quake2.com/dll/tutorials/lcc/index.html) which seemed almost
g_cmds.obj .text: undefined reference to '_ChaseNext'
g_cmds.obj .text: undefined reference to '_ChasePrev'
g_main.obj .text: undefined reference to '_ServerCommand'
p_client.obj .text: undefined reference to '_SV_FilterPacket'
p_client.obj .text: undefined reference to '_GetChaseTarget'
p_client.obj .text: undefined reference to '_UpdateChaseCam'
make: Error code 8
make: 'gamex86.dll' removed.
Are these programming errors, i.e., I need to update function names in my
makefile or game.def? Or is there a different way to compile Quake 2
source? I have programming experience (Java, Python, PHP, etc), although I
am new to C / C++ and using makefiles, so you can throw geek-speak at me :)
Thanks in advance!
-- Ariena
Sounds like you're building a game dll and not just the quake2 engine.

Quake2 was originally compiled using Microsoft Visual C++ 5.0 and
later, VC++ 6.0. If you can get a copy of VC6 or download the free
Visual C++ 2008 Express Edition it might put you further down the path
you want to be on. Quake2 3.21 was the final release and those sources
were buildable on Linux with gcc but as I recall, some tweaking of the
projects was involved. There have certainly been many improvements in
the tools since 1998.

I am not sure what "undefined reference" means in this context. (I
don't use lcc) The fact that .obj's are involved means it's a linker
error and those modules are referring to those functions. The
"*Chase*" functions are defined in g_chase.c so I would make sure that
file is there and included in your makefile. SV_FilterPacket is
defined in g_svcmds.c. Microsoft's linker bombs out with "unresolved
external symbol" when it can't link it from the obj's.

Link errors like these usually mean your makefile isn't building or
including one or more source modules. I am not sure about dependency
maintenance in lcc but I do this in Linux with the gcc tools:

Put this in your makefile

depend:
$(CC) $(CFLAGS) -MM $(OBJS:.o=.c)

depends:
$(CC) $(CFLAGS) -MM *.c > dependencies

$*.o: $*.c
$(CC) $(CFLAGS) -c $*.c

$*.c: $(ORIGDIR)/$*.c
tr -d '\015' < $(ORIGDIR)/$*.c > $*.c

$*.h: $(ORIGDIR)/$*.h
tr -d '\015' < $(ORIGDIR)/$*.h > $*.h

-include dependencies

Then use 'make depends' to invoke make maker and pipe the dependencies
to the "dependencies" file. Then when you add a source module and
header to a project all you have to do is drop them in and rerun the
make depends command.

Another project to look at is R1ch's r1q2 project, a major re-write of
the Q2 engine that fixes a lot of bugs and vulnerabilities in Quake 2.
--
QwazyWabbit
Loading...