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 compiler

c:my_Projwebotclientcontrollerswebotclientwebot.cpp(194) : error C2352: 'myWebot::getMyArClientBase' : illegal call of non-static member function
c:my_Projwebotclientcontrollerswebotclientwebot.h(33) : see declaration of 'myWebot::getMyArClientBase'
c:my_Projwebotclientcontrollerswebotclientwebot.cpp(204) : error C2352: 'myWebot::getMyArClientBase' : illegal call of non-static member function
c:my_Projwebotclientcontrollerswebotclientwebot.h(33) : see declaration of 'myWebot::getMyArClientBase'
c:my_Projwebotclientcontrollerswebotclientwebot.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.

Recommended Answers

All 2 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.