954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

errorcode C2352 - illegal call of a non static member function.

The main function of my program is to realize a client base to the physical Robot and it receives the parameters from the robot. after some processing it links to the webot environment for visual display. so i have used a two classes with the member functions. i have given the code below. i have a class called mywebot, where the client base is initialized and the class called Output handler where it polls the robot from the clientbase and receives the data from the robot. i have given the code below.

//webot.h
class myWebot{
public:
	myWebot();
	 myWebot(ArClientBase *xclient, int argc, char **argv);
	 static void myWebotReset();
  	 static int myWebotRun(int index);
	 ArClientBase * getMyArClientBase();
Protected:
        ArClientBase *myclient;
};
//handler.h

class OutputHandler
{
public:
  OutputHandler(ArClientBase *client);
  virtual ~OutputHandler(void);

protected:
     ArClientBase *myClient;
};
//webot.cpp

ArClientBase * myWebot::getMyArClientBase(){
	return myClient;
}

int myWebot::myWebotRun(int ms)

{
   OutputHandler outputHandler(getMyArClientBase());  


   while (getMyArClientBase()->getRunningWithLock())
  {
  
   }
}


when i am building the above program the compiler gives me the following errorcode error C2352 - illegal call of a non-static member function. i have listed out the error code given by the compilerc:\my_Proj\webotclient\controllers\webotclient\webot.cpp(194) : error C2352: 'myWebot::getMyArClientBase' : illegal call of non-static member function
c:\my_Proj\webotclient\controllers\webotclient\webot.h(33) : see declaration of 'myWebot::getMyArClientBase'
c:\my_Proj\webotclient\controllers\webotclient\webot.cpp(204) : error C2352: 'myWebot::getMyArClientBase' : illegal call of non-static member function
c:\my_Proj\webotclient\controllers\webotclient\webot.h(33) : see declaration of 'myWebot::getMyArClientBase'
c:\my_Proj\webotclient\controllers\webotclient\webot.cpp(204) : error C2227: left of '->getRunningWithLock' must point to class/struct/union


can anybody help me in solving this problem. i have also attached my files with this thread.
webot.cpp

webot.h

handler.h

handler.cpp

Attachments webot.cpp (8.29KB) webot.h (1.54KB) handler.h (1.71KB) handler.cpp (2.12KB)
rmsv_sen
Newbie Poster
1 post since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

First please fix your instructions on what you are doing...then where is your main funcion?

TMD
Newbie Poster
21 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

Static methods can not call non-static methods. You will have to design some other solution to calling that method, such as making it static also.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You