Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Error Adding Custom Function to Source Code

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Locked
Denyer
Member
Member
Posts: 4
Joined: June 13th, 2012, 3:37 pm
Name: Martin

Error Adding Custom Function to Source Code

Post by Denyer »

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:

Code: Select all

extern void  customfunction(physent *d);
I have then added the function in rpg.cpp as (again after the suicide function):

Code: Select all

void customfunction(physent *d)
	{
	  //implementation code to go here
	}
Now I try and call the function in physics.cpp like so:

Code: Select all

game::customfunction(pl)
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
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Error Adding Custom Function to Source Code

Post by Hirato »

If that's at the linking phase, the other game modules will need stub implementations of customfunction at the very least.
Alternatively you just just remove them from the list of targets in he "all" virtual target and build only the RPG.
This is not a url, clicking it is pointless
Denyer
Member
Member
Posts: 4
Joined: June 13th, 2012, 3:37 pm
Name: Martin

Re: Error Adding Custom Function to Source Code

Post by Denyer »

Thanks for the reply,

Hmm, I did think that might be the issue so I tried adding in default implementations into the other game modules, I guess I made a mistake somewhere.

I'll give it another go,

Again thanks for the help Hirato :)
Locked