C game engine support on C++

Hi, I have a relatively simple question: can you use a C game engine with a C++ IDE and the C++ Language? (I use Microsoft Visual C++ Express)? Specifically, I am interested in id Tech 2. Thanks!
"Use" as in...?
C++ is strictly a superset of C. You can use any code in C as C++ code and it should still work. At least, as far as I know...

-Albatross
No, it isn't. It's perfectly possible to write valid C code that's invalid C++ code. That's partly why I asked what OP means by "use".
Ah... so in that case I'd need an example. And please do not count "evil" features as invalid.

Because from the information section of this website:
C++ is backwards compatible with the C language. Any code written in C can easily be included in a C++ program without making any change.


-Albatross
T *new=malloc(sizeof(T));
Last edited on
more examples:

1
2
3
4
5
6
7
8
9
10
11
12
int class;  // these work in C, but fail in C++ for obvious reasons
int template;
int typename;

//====
void AFunction();

int main()
{
  AFunction(1,2,3);  // this works in C
  return 0;
};


fun stuff
Last edited on
Let's just stop this right here before it gets out of hand.
awwww =P
I need to get rid of this caffeine dependency.

Or, I should start posting on this forum in the early mornings rather than late nights.

Now that I look, they're all obvious.

-Albatross
By "use" i mean write/edit games with it, or use/make a code template with it. (Like, by template, I mane you can select and "id Software 2" Project from the "new project" section to start with it imported w/ some code, like with Win32 or OGRE)
You don't actually write any C or C++ to do that. You use the specialized language the engine provides to write scripts that will be interpreted at run time by the engine. The only case where you'd need to write C/++ is to write plugins, assuming the engine has that feature.
This is different from a rendering engine like OGRE because you interface with OGRE by linking with its library and calling functions. id Tech engines behave more like language interpreters.

I suppose you could use VC++ to write the scripts, but it won't give you any advantage over a simpler editor like, say, Notepad++. You won't get any code completion or anything like that, and there's nothing to compile.
Last edited on
Would there be a compile error because it is in C? Or would I have to avoid functions that are in C++ but not C when using it (or vice versa)?
...What? No, you don't need to write any C or C++ to use the engine.
Topic archived. No new replies allowed.