How to add a file to the engine

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

How to add a file to the engine

Post by chronologicaldot »

I ran into a snag lately. I want to add a class with its own files to the engine, but I don't know exactly how to include them.
I have a class called CIrrDeviceCustomPresenter, inside a .h and a .cpp with the same name.
In the Makefile, I assume the following:

Code: Select all

CUSTOMPRESDEVICE = CIrrDeviceCustomPresenter.o

# Next variable is for additional scene nodes etc. of customized Irrlicht versions
EXTRAOBJ = $(CUSTOMPRESDEVICE)
However, when I try to compile - and everything compiles fine, no errors - the object file CIrrdeviceCustomPresenter.o has next to nothing in it, unlike the other .o files for everything else. And as expected, I end up with linker errors complaining my class constructor doesn't exist. I didn't name my functions wrong or make any syntax errors. I checked again and again. The issue seems to be the compilation of my object file.

So there's the question: How do you add files to the engine so they compile correctly with everything else?
I've done this before, but I forgot.
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: How to add a file to the engine

Post by chronologicaldot »

Update: Turns out, I was depending on a precompiler variable that I set in IrrCompileConfig.h ... and I forgot to include that file at the top of my header CIrrDeviceCustomPresenter.h
The object file is full now, but I still have the linker problem.
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: How to add a file to the engine

Post by chronologicaldot »

Update: Found the issue. In the .cpp file, I had ifndef but in the .h I had ifdef for the same variable indicating when to compile. Makes a big difference one letter "n", doesn't it?
Post Reply