Thread: can anyone help me in solving this error C2352 - illegal call of a Non-static member

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    2

    Post can anyone help me in solving this error C2352 - illegal call of a Non-static member

    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. here i am linking two environments ARIA and Webot.

    webot.h


    Code:
    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

    Code:
    class OutputHandler
    {
    public:
      OutputHandler(ArClientBase *client);
      virtual ~OutputHandler(void);
    
    protected:
         ArClientBase *myClient;
    };

    webot.cpp

    Code:
    ArClientBase * myWebot::getMyArClientBase(){
    	return myClient;
    }
    
    int myWebot::myWebotRun(int ms)
    
    {
       OutputHandler outputHandler(getMyArClientBase());  
    
    
       while (getMyArClientBase()->getRunningWithLock())
    
      {
      
       }
    }
    
    int mainLoop ()
    {
    	
    	robot_live(myWebotReset);
        robot_run(myWebotRun);
    	
    	return 0;
    }

    Code:
    int main (int argc, char **argv)
    {
    	ArClientBase *client =new ArClientBase();
        myWebot *mw = new myWebot(client,argc,argv);
    
        mw->mainLoop();
    	return 0;
    }
    when i am building the project with the above codes, the compiler gives me the following error the highlighted places (i.e Bold line)

    c:\my_Proj\webotclient\controllers\webotclient\web ot.h(43) : see declaration of 'myWebot::getFlag'
    c:\my_Proj\webotclient\controllers\webotclient\web ot.cpp(194) : error C2352: 'myWebot::getMyArClientBase' : illegal call of non-static member function
    c:\my_Proj\webotclient\controllers\webotclient\web ot.h(33) : see declaration of 'myWebot::getMyArClientBase'
    c:\my_Proj\webotclient\controllers\webotclient\web ot.cpp(204) : error C2352: 'myWebot::getMyArClientBase' : illegal call of non-static member function
    c:\my_Proj\webotclient\controllers\webotclient\web ot.h(33) : see declaration of 'myWebot::getMyArClientBase'
    c:\my_Proj\webotclient\controllers\webotclient\web ot.cpp(204) : error C2227: left of '->getRunningWithLock' must point to class/struct/union.

    can anybody help me how to overcome this problem and to build the solution.
    Last edited by rmsv_sen; 03-02-2008 at 08:45 PM. Reason: to introduce the main function

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Linking errors with static var
    By Elysia in forum C++ Programming
    Replies: 8
    Last Post: 10-27-2007, 05:24 PM
  3. SSH Hacker Activity!! AAHHH!!
    By Kleid-0 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 03-06-2005, 03:53 PM
  4. opengl program as win API menu item
    By SAMSAM in forum Game Programming
    Replies: 1
    Last Post: 03-03-2003, 07:48 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM