0

I got some problems with QOpenGLFunctions_4_1_Core most likely in the version 6.0 in Qt. The QOpenGLFunctions 4.1 function appears not to apply in the call function of the code for some reasons, and prevent the code running at all. In the version 6.0 Qt, I had to call the function <QtOpenGL/QOpenGLFunctions_4_1_Core> to even have the means of calling the code functions of relevant part. Is this the main reason for the error?

//visualobject.h
#ifndef VISUALOBJECT_H
#define VISUALOBJECT_H

#include <QtOpenGL/QOpenGLFunctions_4_1_Core>
#include [...]

class VisualObject: public QOpenGLFunctions_4_1_Core
{
public:
    VisualObject();
    ~VisualObject();
[...]
};

#endif

//visualobject.cpp full code for now
VisualObject::VisualObject()
{

}

VisualObject::~VisualObject()
{
    glDeleteVertexArrays(1, &mVAO);
    glDeleteBuffers(1, &mVBO);
}

error: undefined reference to `__imp__ZN25QOpenGLFunctions_4_1_CoreC2Ev' In function 'VisualObject::Visual Object'

error: undefined reference to `__imp__ZN25QOpenGLFunctions_4_1_CoreC2Ev' In function 'VisualObject::~Visual Object'

error: undefined reference to `QOpenGLFunctions_4_1_Core::initializeOpenGLFunctions()'

Scheff's Cat
  • 19,528
  • 6
  • 28
  • 56
  • Are you aware that these are link errors? – Scheff's Cat Jan 28 '21 at 12:14
  • Looking at the doc. of [QOpenGLFunctions_4_1_Core Class](https://doc.qt.io/qt-6.0/qopenglfunctions-4-1-core.html), you find the link options you have to apply. (Oh, Qt provides CMake link options in the doc. - that's new.) Please, check whether you applied them properly. (If so, it could be worth to [edit] this info into the question.) – Scheff's Cat Jan 28 '21 at 12:15
  • _I had to call the function _ Ehem... `` is not a function, you know? (With an `#include` in front, it's a preprocessor directive to include a header.) – Scheff's Cat Jan 28 '21 at 12:19

0 Answers0