Error Adding Custom Function to Source Code
Posted: June 17th, 2012, 8:20 am
Hi there,
Hopefully someone can explain where I'm going wrong. I'm incredibly rusty at writing in C++ and I'm having trouble trying to add my own custom function.
Currently in igame.h I've added after the the suicide function:
I have then added the function in rpg.cpp as (again after the suicide function):
Now I try and call the function in physics.cpp like so:
However when I try and recompile I get the error:
.objs\engine\physics.o:physics.cpp|| undefined reference to `game::customfunction(physent*)'|
I'm guessing I'm not fully understanding the language. Could someone explain what is causing the error?
Cheers,
Denyer
Hopefully someone can explain where I'm going wrong. I'm incredibly rusty at writing in C++ and I'm having trouble trying to add my own custom function.
Currently in igame.h I've added after the the suicide function:
Code: Select all
extern void customfunction(physent *d);
Code: Select all
void customfunction(physent *d)
{
//implementation code to go here
}
Code: Select all
game::customfunction(pl)
.objs\engine\physics.o:physics.cpp|| undefined reference to `game::customfunction(physent*)'|
I'm guessing I'm not fully understanding the language. Could someone explain what is causing the error?
Cheers,
Denyer