.:: 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)

andrewcaus 21-08-2005 10:42

FakeClientCommand
 
I'm having some problems when it comes to the bots selecting a team. I get this issue when compiling:

Code:


--------------------Configuration: dll - Win32 Debug--------------------
Linking...
  Creating library .\Debug/csbots.lib and object .\Debug/csbots.exp
dllapi.obj : error LNK2001: unresolved external symbol "void __cdecl FakeClientCommand(struct edict_s *,char *,char *,char *)" (?FakeClientCommand@@YAXPAUedict_s@@PAD11@Z)
.\Debug/csbots.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
csbots.dll - 2 error(s), 0 warning(s)

My FakeClientCommand line:

Code:

FakeClientCommand(pEdict, "jointeam", "2", NULL);
I think this may have to do with these warnings I get where I put in the code:

Code:

D:\Documents and Settings\Administrator.ANDREW\My Documents\csbots\dllapi.cpp(66) : warning C4700: local variable 'pEdict' used without having been initialized
If so, how do I initialize pEdict? I searched the HPBBot source code but couldn't find where it did it.

The Storm 21-08-2005 11:17

Re: FakeClientCommand
 
For firs time I see FakeClientCommand() like this one that you show off
FakeClientCommand(struct edict_s *,char *,char *,char *)
Check the headers files *.h and see is the FakeClientCommand() is defined correct there. And don't debug the bot. Configurate it for Release. ;)

andrewcaus 21-08-2005 11:33

Re: FakeClientCommand
 
1 Attachment(s)
Setting it to release doesn't work. How should it be defined exactly? And I don't think I have defined pEdict correctly either, how do I do that?

(attached a screenshot)

sPlOrYgOn 21-08-2005 15:05

Re: FakeClientCommand
 
/* I should never post without reading more..
* and never post when sleepy..
*/

Pierre-Marie Baty 21-08-2005 15:52

Re: FakeClientCommand
 
this
Code:

error: unresolved external symbol
means that you prototyped a function that doesn't exist in your project. It literally means: "hey, it's the linker here. The C compiler gave me a compiled C file in which there is a call for a function that's in another file, but I don't know where in hell I can find it, and it didn't told me either, so I don't know what to do!"

Check if that function exists the way the linker expects to find it. And ignore that warning, it will get away when the problem will be solved.

andrewcaus 22-08-2005 08:45

Re: FakeClientCommand
 
How does it expect to find it?

Sorry for all these questions, just not the most fluent programmer there is. :)

The Storm 22-08-2005 09:56

Re: FakeClientCommand
 
As I see you are fixed the problem with FakeClientCommand().
And it seems that you want to make new bot for CS ?
Well isn't your CS version too old? I think that is CS 1.0.
Better update to 1.5 or 1.6 and then try again to add bots.
And btw to make bot to join directly in team 2 your must call FakeClientCommand() like this one:
Code:

FakeClientCommand (pEdict, "menuselect", "2", NULL);
After that to select a class like 3 it must be:
Code:

FakeClientCommand (pEdict, "menuselect", "3", NULL);
So you can try again. ;)

andrewcaus 22-08-2005 10:03

Re: FakeClientCommand
 
Yes, I have added those to commands, but I get a link error:

Linking...
Creating library .Debug/csbots.lib and object .Debug/csbots.exp
dllapi.obj
: error LNK2001: unresolved external symbol "void __cdecl FakeClientCommand(struct edict_s *,char *,char *,char *)" [color=#000000]([email=[/color]"?FakeClientCommand@@YAXPAUedict_s@@PAD11@Z"]?FakeClientCommand@@YAXPAUedict_s@@PAD11@Z[/email])
.Debug
/csbots.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
csbots.dll - 2 error(s), 0 warning(s)

The Storm 22-08-2005 10:10

Re: FakeClientCommand
 
I told you - Don't debug the bot. It must be for release.
After that Pierre-Marie Baty told you how to fix the problem.

andrewcaus 22-08-2005 10:10

Re: FakeClientCommand
 
I just searched the HPB Bot and POD Bot source and it doesn't do anything I haven't done. Is there some code I can use to declare it again or something? I dunno, I'm lost.

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 23:47.

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