Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. openGL in Mingw5.3 in Qt.5.11 error: undefined reference to `_imp__glBegin@4'
QtWS25 Last Chance

openGL in Mingw5.3 in Qt.5.11 error: undefined reference to `_imp__glBegin@4'

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 362 Views
  • 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.
  • mr ZXM Offline
    mr ZXM Offline
    mr ZX
    wrote on last edited by
    #1

    hi
    I'm using Qt 5.11 and mingw5.3_32bit
    i wont using openGl object like QOpenGLWidget or QGL Widget
    i give error like :
    D:\web_for_up\mrzx-website\qt\MRZX_ir_2\myMenu\myMenu\myglwidget.cpp:14: error: undefined reference to `_imp__glClearColor@16'

    D:\web_for_up\mrzx-website\qt\MRZX_ir_2\myMenu\myMenu\myglwidget.cpp:28: error: undefined reference to `_imp__glBegin@4'
    ...
    how to fi this?

    #ifndef MYGLWIDGET_H
    #define MYGLWIDGET_H
    
    #include <QOpenGLWidget>
    
    class myGLWidget: public QOpenGLWidget
    {
        Q_OBJECT
    public:
        myGLWidget(QWidget *parent=0);
    protected:
        void initializeGL();
        void resizeGL(int w, int h);
        void paintGL();
    
    };
    
    #endif // MYGLWIDGET_H
    
    #include <QtWidgets>
    #include "myglwidget.h"
    #include <QtOpenGL>
    myGLWidget::myGLWidget(QWidget *parent):
        QOpenGLWidget(parent)
    {
    
    }
    
    void myGLWidget::initializeGL()
    {
         glClearColor(1.0f, 1.0f, 0.0f, 1.0f);
    
    }
    
    void myGLWidget::resizeGL(int w, int h)
    {
        glViewport(0, 0, w, h);
    }
    
    void myGLWidget::paintGL()
    {
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
               glColor3f(1,0,0);
                glBegin(GL_TRIANGLES);
                glVertex3f(-0.5, -0.5, 0);
                glVertex3f( 0.5, -0.5, 0);
                glVertex3f( 0.0, 0.5, 0);
                glEnd();
    }
    
    
    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