How can I move these global variables to be
The problem you are having is you are trying to both define and declare a class member variable at the same time. You can't. Instead you need to split it:

protected:
    ros::Publisher chatter;

ROSController::ROSController() : chatter("chatter", &amp;str_msg)
{
    this-&gt;_nh.initNode();
//  this-&gt;_nh.advertise(chatter);
}


That is, set up the variable as a protected member, then have the constructor call the constructor for you with the right parameters.

(I think that is the right syntax off the top of my head).