[quake3] Compiling ioquake3 with g++

Stefan Wichmann stefanw at gmx.org
Wed May 23 04:20:13 EDT 2007


Hi everyone,

and first of all: Thanks for the answers...

Ian Kumlien wrote:
> Doing the following to all files:
> 
> #ifdef __cplusplus
> extern "C" {
> #endif
> 
> <code />
> 
> #ifdef __cplusplus
> }
> #endif
> 
> Would be the standard way of doing it.

I tried that, but this only works if the source between this marcos is
pure ANSI C. As I noted, I want (read "have") to change this basic game
structs into classes. After this, it isn't C anymore.

> But it feels kinda obvius. Porting it to C++ would involve so much more
> work. But is there something special that forces you to compile it with
> C++?

The framework I have to use is written in C++. And since it's
integration into Quake is my task, there is no real way around this. But
 as I said: I have no intention to port the whole source. Only the
entity structs have to be changed, so that they can be managed by the
framework.

I started to make the described changes... The replacement of the
structs by classes with public attributes works pretty well (aside from
the compiler errors caused by illegal casts). But there are two things
that came up, when I was working on this:

1) When compiling the renderer-source (code/renderer/*) there many
strange errors, like these:

tr_light.c:47: error: expected primary-expression before ‘||’ token
tr_light.c:47: error: expected primary-expression before ‘->’ token

or

tr_local.h:493: error: expected unqualified-id before ‘||’ token

My friend Google says, that this may happen due to missing semicolons in
 the header files... but i couldn't find anything. Any ideas?

2) Changing structs to classes breaks the compilation with q3lcc (since
it is C-only). Is anyone aware of a good introduction to the whole
qvm-concept? If I got it  right, the game logic is compiled with the
q3lcc (a variation of the standard lcc), linked with q3asm and can then
be interpreted by the quake virtual machine... If this is correct, I
have two more questions:

Is there a way to get around the whole qvm-story by linking the game
logic directly into the engine (like statically linking a library)?

Could I replace the q3lcc with the g++ and let it produce object code
that q3asm understands?

I know this are many questions, but I would really appreciate some hints
from the experts. Thank you very much in advance!

Cheers
Stefan



More information about the quake3 mailing list