Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Undefined symbols for architecture x86_64: "QWidget::KeyPressEvent(QKeyEvent*)"
Forum Updated to NodeBB v4.3 + New Features

Undefined symbols for architecture x86_64: "QWidget::KeyPressEvent(QKeyEvent*)"

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 4.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mchung
    wrote on last edited by
    #1

    Now I understand from searching for a few hours this means that there virtual function that has not been implemented or a v table value that has been missing, I have been trying for the past 4 hours and no luck just to compile a core profile opengl program, from the 4.8 documentation. This is my first time using the QT Frame work so if someone can help me out that would be great =).

    It appears I have implemented the KeyPressEvent virtual function in RenderMii.cpp but its coming up with another error as you can see in the compile error. I am using QTCreator with Clang and I also tried GCC didn't work as well.

    moc_rendermii.o -F/Developer/QtSDK/Desktop/Qt/4.8.0/gcc/lib -L/Developer/QtSDK/Desktop/Qt/4.8.0/gcc/lib -framework QtOpenGL -framework QtGui -framework QtCore -framework OpenGL -framework AGL
    Undefined symbols for architecture x86_64:
    "QWidget::KeyPressEvent(QKeyEvent*)", referenced from:
    RenderMii::KeyPressEvent(QKeyEvent*) in rendermii.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [RenderMii.app/Contents/MacOS/RenderMii] Error 1
    make: Leaving directory `/Users/MichaelChung/projects/RenderMii'
    15:47:23: The process "/usr/bin/make" exited with code 2.
    Error while building project RenderMii (target: Desktop)
    When executing build step 'Make'

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchung
      wrote on last edited by
      #2

      Here is some code

      @
      #include <QCoreApplication>
      #include <QGLWidget>
      #include <QGLBuffer>
      #include <QGLShaderProgram>
      #include <QKeyEvent>

      class RenderMii : public QGLWidget
      {
      Q_OBJECT

      public:
      RenderMii(const QGLFormat & gl_format,QWidget * parent = 0);
      ~RenderMii();

      protected:
      virtual void InitializeGL();
      virtual void ResizeGL(int w, int h);
      virtual void PaintGL();

      virtual void KeyPressEvent(QKeyEvent * e);
      

      private:
      bool PrepareShaderProgram(const QString & vertex_shader_path,
      const QString & fragment_shader_path);
      QGLShaderProgram m_shader;
      QGLBuffer m_vertex_buffer;

      };

      void RenderMii::KeyPressEvent(QKeyEvent * e )
      {
      switch ( e->key() )
      {
      case Qt::Key_Escape:
      QCoreApplication::instance()->quit();
      break;

      default:
          QGLWidget::KeyPressEvent( e );
      }
      

      }
      @

      [[marked up code, Tobias]]

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        It's QGLWidget::keyPressEvent( e ) - with a lowercase k. Then for your own method name too, of course, otherwise it wouldn't be a reimplementation of a virtual method, but a completely new method.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mchung
          wrote on last edited by
          #4

          Hey thanks for replying I got it working silly me I renamed functions with capitals instead of overriding them correctly I forgot that I was overriding members from the base class, anyways thats all fixed and I just learned that RC doesn't support osx lion correctly and the opengl context isn't created properly when I write the shader it tells me #version 150 glsl is not supported which is true since the context set up is version 1.0 opengl :S

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved