Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
C++ Linker error... I don't get it

 
Post new topic   Reply to topic Printable version
 View previous topic  Merv tutorial link is dead? Post :: Post Compiling with Dev-C++  View next topic  
Author Message
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Apr 29, 2007 5:57 pm    Post subject: C++ Linker error... I don't get it Reply to topic Reply with quote

I posted this on ssforum ... figured I'd post it here too, cause it's really blocking me now and I can't do anything >=(

----------------

I just started playing around with Merv stuff... but now I'm getting an error from the linker when it's building the exe:

Error 1 error LNK2019: unresolved external symbol "private: class timerms __thiscall botInfo::testtimer(void)" (?testtimer@botInfo@@AAE?AVtimerms@@XZ) referenced in function "public: void __thiscall botInfo::gotCommand(struct Player *,struct Command *)" (?gotCommand@botInfo@@QAEXPAUPlayer@@PAUCommand@@@Z) command.obj

The bug comes from the line:
Code: Show/Hide
int timervalue = testtimer().ReadTimer();

ReadTimer() is a int function of the class 'timerms'

I get linker errors anytime I call a non-void method within that class... wtf... What am i doing wrong?


Here's the relevant code... If you notice anything weird or stuff I shouldn't be doing, please tell me, even if it's not related to the problem... It's the first time I do C++

spawn.h
Code: Show/Hide
[...]
#include "timerms.h"

[...]

class botInfo
{
   // Put bot data here
   timerms testtimer();
[...]



commands.cpp
Code: Show/Hide
#include "spawn.h"
[...]
void botInfo::gotHelp(Player *p, Command *c)
{
[...]
int timervalue = testtimer().ReadTimer(); //Could be any other non-void call, it does the same error
[...]




timerms.h
Code: Show/Hide
#include "spawn.h"

#define NOT_INITIALIZED -1

class timerms
{
   int starttime;
   int pausetime;
   
public:
   timerms()
   {
      ResetTimer();
   }
   bool isrunning;
   bool ispaused() { return (!isrunning && pausetime != NOT_INITIALIZED);}
   void StartTimer(int starttime);
   void StartTimer();
   void PauseTimer(int pausetime);
   void PauseTimer();
   void ResumeTimer(int resumetime);
   void ResumeTimer();
   void ResetTimer();
   int ReadTimer();

   ~timerms()
   {
   }
};


timerms.cpp
Code: Show/Hide
#include "spawn.h"

[...]

int timerms::ReadTimer()
{
   return 0; //No matter what code in here, gives the same error
}




I searched on Google and the only thing I found was about some libraries and stuff... but I'm not using any API or external dll or whatever...

Oh, and this is with Visual Studio 2005 pro
_________________
(Insert a bunch of dead links here)
Back to top
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:42
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Sun Apr 29, 2007 6:39 pm    Post subject: Reply to topic Reply with quote

Where is the following code? It is looking for a definition of the function, but cannot find it.
Code: Show/Hide
timerms botInfo::testtimer()
{
   //Stuff
}

My guess is you wanted to define that as a variable instead of a function inside your class.
Back to top
View users profile Send private message Add User to Ignore List Send email
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Apr 29, 2007 6:41 pm    Post subject: Reply to topic Reply with quote

testtimer is an instance of 'timerms' class

maybe I'm doing something wrong though...
But it works for all void functions... EDIT: hm no it doesn't, I thought it did for some reason... hmmm

Code: Show/Hide
class botInfo
{
   // Put bot data here
   timerms testtimer();


my declaration is probably wrong...

when calling functions of the class, should it be like:
testtimer().ResetTimer();
or
testtimer.ResetTimer();
?
For now it only lets me use the first way... which I don't think is right so.. emm..


EDIT:
OK got it lol

hmmm ok since I was declaring it as a class member, I can't call the constructor with it or anything, so it doesn't need the ()'s... mhm I seeeeeeee

thanks icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 17 page(s) served in previous 5 minutes.

phpBB Created this page in 0.535674 seconds : 28 queries executed (90.0%): GZIP compression disabled