02 Feb 13, 05:50AM
(This post was last modified: 02 Feb 13, 05:54AM by Felix-The-Ghost.)
(31 Jan 13, 11:44PM)Lee Wrote: I'm trying to use the drawequipicons() function that is in the renderhud.cpp in the dokill() function that is inside of the clientgame.cpp
I read that to use functions defined in another cpp, I need to prototype them in a header (.h) file and then #include it in my clientgame.cpp.
I'm not quite sure if drawequipicons() is prototyped in a header or not, how do I find that out?
In the clientgame.cpp file on a line before doKill() add this:
[SELECT ALL] Code:
void drawequipicons(playerent *p);
If you put it immediately before it will look like this:
[SELECT ALL] Code:
void drawequipicons(playerent *p);
void dokill(playerent *pl, playerent *act, bool gib, int gun)
That bit of code is what is known as the prototype that you mentioned. In this case it lets the following code know that function is defined elsewhere.
@Jpablon: Functions in C++ have external linkage by default.