QGLViewer in ROS: "undefined reference to 'vtable' " error

asked 2013-12-19 05:11:23 -0500

ubisum gravatar image

hello everyone. I defined a class extending QGLVIewer:


#include <QGLViewer/qglviewer.h>
#include "/home/ubisum/fuerte_workspace/thesis_pack/src/coord.h"

using namespace std;

class scanViewer: public QGLViewer{

    void setCoordsList(vector<coord>);

    virtual void draw();
    virtual void init();
    virtual QString helpString() const;

    vector<coord> coordsList;

#endif // SCANVIEWER_H

Then, I implemented the class:

#include "scanviewer.h"
#include "/home/ubisum/fuerte_workspace/thesis_pack/src/coord.h"

using namespace std;


void scanViewer::setCoordsList(vector<coord> inputCoords){
    coordsList = inputCoords;

//void scanViewer::draw(){}

void scanViewer::draw(){
    for(int i = 0; i<(int)coordsList.size(); i++){
        glColor3f(0, 1.0, 0);
        glVertex3f(coordsList[i].x, coordsList[i].y, 0);

//void scanViewer::init(){}

void scanViewer::init(){
    // Restore previous viewer state.

    // Opens help window

QString scanViewer::helpString() const
  QString text("<h2>S i m p l e V i e w e r</h2>");
  text += "Use the mouse to move the camera around the object. ";
  text += "You can respectively revolve around, zoom and translate with the three mouse buttons. ";
  text += "Left and middle buttons pressed together rotate around the camera view direction axis<br><br>";
  text += "Pressing <b>Alt</b> and one of the function keys (<b>F1</b>..<b>F12</b>) defines a camera keyFrame. ";
  text += "Simply press the function key again to restore it. Several keyFrames define a ";
  text += "camera path. Paths are saved when you quit the application and restored at next start.<br><br>";
  text += "Press <b>F</b> to display the frame rate, <b>A</b> for the world axis, ";
  text += "<b>Alt+Return</b> for full screen mode and <b>Control+S</b> to save a snapshot. ";
  text += "See the <b>Keyboard</b> tab in this window for a complete shortcut list.<br><br>";
  text += "Double clicks automates single click actions: A left button double click aligns the closer axis with the camera (if close enough). ";
  text += "A middle button double click fits the zoom of the camera and the right button re-centers the scene.<br><br>";
  text += "A left button double click while holding right button pressed defines the camera <i>Revolve Around Point</i>. ";
  text += "See the <b>Mouse</b> tab and the documentation web pages for details.<br><br>";
  text += "Press <b>Escape</b> to exit the viewer.";
  return text;

/*int main(int argc, char** argv){
  return 0;

The scanViewer class is then used in an external function, defined in another class, in another file:

void messageListener::listen(int c, char** v){
scanViewer sw;

Finally, I compiled from inside my make folder inside my ROS package and that's the error I get:

CMakeFiles/thesis_main.dir/src/messageListener.o: In function `messageListener::listen(int, char**)':
/home/ubisum/fuerte_workspace/thesis_pack/src/messageListener.cpp:847: undefined reference to `scanViewer::scanViewer()'
CMakeFiles/thesis_main.dir/src/messageListener.o: In function `~scanViewer':
/home/ubisum/fuerte_workspace/thesis_pack/src/viewers/scanviewer.h:9: undefined reference to `vtable for scanViewer'
/home/ubisum/fuerte_workspace/thesis_pack/src/viewers/scanviewer.h:9: undefined reference to `vtable for ...
edit retag flag offensive close merge delete