.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   FakeClientCommand (http://forums.bots-united.com/showthread.php?t=4377)

sPlOrYgOn 22-08-2005 10:29

Re: FakeClientCommand
 
The linker cannot find where FakeClientCommand is defined..
it is externed but not defined anywhere so the function doesn't exist and the linker can't find it.

andrewcaus 22-08-2005 10:32

Re: FakeClientCommand
 
I defined it as:

void FakeClientCommand(edict_t *pBot, char *arg1, char *arg2, char *arg3);

Now, if I take it away, i get an error pointing to FakeClientCommand saying undeclared identifier. So what's the linker on about?

sPlOrYgOn 22-08-2005 10:38

Re: FakeClientCommand
 
do you have the body of the function defined somewhere?

andrewcaus 22-08-2005 10:48

Re: FakeClientCommand
 
No...

What is the code for it?

andrewcaus 22-08-2005 13:23

Re: FakeClientCommand
 
Looking through HPB Bot and POD Bot, I can't find it.

The Storm 22-08-2005 14:08

Re: FakeClientCommand
 
Maybe you need by some more C/C++ lesons. ;)
Let me explain:
So if you have the function FakeClientCommand() defined in dll.cpp and you want to use it in other *.cpp like bot.cpp you must define it as global function in some header file *.h like bot.h and you must be sure that bot.cpp will use this header.
So if the function is defined in dll.cpp in this way:
Code:

FakeClientCommand(bla, bla, bla)
{
// bot code
}

you must define again that function for global to use it everywere in some header like bot.h in this way:
Code:

FakeClientCommand(bla, bla, bla);
But in to the header don't define the hole function again with the code, just define only the name FakeClientCommand(bla, bla, bla);
And now you can use FakeClientCommand() in every .cpp that will use the bot.h header file. I hope that this will help you. ;)

Pierre-Marie Baty 22-08-2005 17:50

Re: FakeClientCommand
 
...and BTW, the bot can be built either in the DEBUG or in the RELEASE configuration, the only difference will be that in the latter the debug symbols will be stripped out, whereas in the former they're here and all the variables are nulled before use - they aren't in release, their state is undefined.


All times are GMT +2. The time now is 17:20.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.