Results 1 to 1 of 1

Thread: Buid error: collect2.exe: error: ld returned 1 exit status

  1. #1
    Join Date
    Apr 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Buid error: collect2.exe: error: ld returned 1 exit status

    Im new on Qt5.6, im following the tutorial on youtube to run my project qt+opengl, but when I use the glClearColor and glClear functions, it shows this error, can someone help me to solve it?

    pro file
    #-------------------------------------------------
    #
    # Project created by QtCreator 2016-04-20T15:40:00
    #
    #-------------------------------------------------

    QT += core gui opengl

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = opengl_test
    TEMPLATE = app


    SOURCES += main.cpp\
    mainwindow.cpp \
    glwidget.cpp

    HEADERS += mainwindow.h \
    glwidget.h

    FORMS += mainwindow.ui

    glwidget.h file
    #ifndef GLWIDGET_H
    #define GLWIDGET_H

    #include <QGLWidget>
    class GLWidget : public QGLWidget
    {
    Q_OBJECT
    public:
    explicit GLWidget(QWidget *parent = 0);
    void initializeGL();
    void paintGL();
    void resizeGL(int w, int h);

    };

    #endif // GLWIDGET_H

    glwidget.cpp file
    #include "glwidget.h"

    GLWidget::GLWidget(QWidget *parent):
    QGLWidget(parent)
    {


    }

    void GLWidget::initializeGL(){
    glClearColor(1, 1, 0, 1);
    }

    void GLWidget:aintGL(){
    glClear(GL_COLOR_BUFFER_BIT);
    }
    void GLWidget::resizeGL(int w, int h){

    }

    And here are my errors:
    debug/glwidget.o: In function `ZN8GLWidget12initializeGLEv':
    C:\Users\xingchen ming\Documents\build-opengl_test-Desktop_Qt_5_6_0_MinGW_32bit-Debug/../opengl_test/glwidget.cpp:11: undefined reference to `_imp__glClearColor@16'
    debug/glwidget.o: In function `ZN8GLWidget7paintGLEv':
    C:\Users\xingchen ming\Documents\build-opengl_test-Desktop_Qt_5_6_0_MinGW_32bit-Debug/../opengl_test/glwidget.cpp:15: undefined reference to `_imp__glClear@4'
    collect2.exe: error: ld returned 1 exit status
    Makefile.Debug:71: recipe for target 'debug\opengl_test.exe' failed
    mingw32-make[1]: *** [debug\opengl_test.exe] Error 1

    thx for your attention


    Added after 24 minutes:


    Problem solved.
    Last edited by Demonlaplce; 21st April 2016 at 09:43.

Similar Threads

  1. Replies: 1
    Last Post: 28th December 2012, 22:13
  2. error: collect2: ld returned 1 exit status
    By Splatify in forum Newbie
    Replies: 2
    Last Post: 13th February 2011, 18:09
  3. error: collect2: ld returned 1 exit status
    By srohit24 in forum Qt Programming
    Replies: 3
    Last Post: 1st December 2009, 06:32
  4. error: collect2: ld returned 1 exit status
    By nataly in forum Qt Programming
    Replies: 4
    Last Post: 13th October 2009, 13:39
  5. collect2: ld returned 1 exit status error
    By gmsk19 in forum Qt Tools
    Replies: 11
    Last Post: 25th July 2009, 02:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.