Results 1 to 14 of 14

Thread: Opengl issue with Qt4.4.3

  1. #1
    Join Date
    Nov 2008
    Location
    Caracas - Venezuela
    Posts
    29
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Opengl issue with Qt4.4.3

    Hi everyone, well my problems is that I tried to do a basic aplication where I could open a OGLWidget and I says that I dont haves de #include<OGLWidget> in the defeaul folder.

    So, What library shoud I open if I want to do this? (I'm using Qt4.4.3 Opensource).

    And Here is my code:
    jose.h

    Qt Code:
    1. #ifndef JOSE_H
    2. #define JOSE_H
    3.  
    4. #include <QApplication>
    5. #include <QDialog>
    6. #include <QPushButton>
    7. #include <QWidget>
    8. #include <QFont>
    9. #include <OGLWidged> //-----Here's the "missing file"
    10.  
    11. class josewidget : public QWidget
    12. {
    13. public:
    14. josewidget (QWidget *parent = 0);
    15.  
    16. //public slots:
    17. // void repaint();
    18.  
    19. protected:
    20. void paintEvent(QPaintEvent *event);
    21. void repaint();
    22. };
    23.  
    24. #endif
    To copy to clipboard, switch view to plain text mode 

    jose.cpp
    Qt Code:
    1. #include "jose.h"
    2. #include <QTime>
    3. #include <QTimer>
    4. #include <QPainter>
    5. #include <QPaintEvent>
    6. //#include <QGLWidget>
    7.  
    8. josewidget::josewidget(QWidget *parent)
    9. : QWidget(parent)
    10. {
    11. //OGLwidget = new OGLWidget;
    12.  
    13. setFixedSize(400,200);
    14. setAutoFillBackground(false);
    15.  
    16. QPushButton *ok = new QPushButton(tr("Ok"),this);
    17. ok->setGeometry (60,40,75,30);
    18. ok->setFont(QFont("Times",18, QFont::Bold));
    19.  
    20. QPushButton *quit = new QPushButton(tr("Salir"),this);
    21. quit->setGeometry (150,40,165,30);
    22. quit->setFont(QFont("Times",18, QFont::Bold));
    23.  
    24. connect(quit,SIGNAL(clicked()),qApp,SLOT(quit()));
    25. connect(ok,SIGNAL(clicked()),qApp,SLOT(Event));
    26.  
    27. }
    28.  
    29.  
    30.  
    31. void josewidget::paintEvent(QPaintEvent *event)
    32. {
    33.  
    34. unsigned long int i;
    35. QTime time;
    36. time.currentTime();
    37. qsrand ((unsigned int)time.second());
    38.  
    39. QPainter painter(this);
    40. painter.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap));
    41. painter.setRenderHint(QPainter::Antialiasing, true);
    42. for(i=0;i<=100000;i++){
    43. painter.drawPoint(qrand()%400, qrand()%300);
    44. }
    45. }
    To copy to clipboard, switch view to plain text mode 

    main.cpp:
    Qt Code:
    1. #include "jose.h"
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication app(argc, argv);
    6. josewidget *dialog = new josewidget;
    7. dialog->show();
    8. return app.exec();
    9. }
    To copy to clipboard, switch view to plain text mode 

    I tried to compiled too the "hellogl" example and it says errors like this one:



  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Opengl issue with Qt4.4.3

    No error is given!

    Anyway, did you put "QT += opengl" in your pro file?
    I'm a rebel in the S.D.G.

  3. #3
    Join Date
    Nov 2008
    Location
    Caracas - Venezuela
    Posts
    29
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opengl issue with Qt4.4.3

    Thank you for aswering...

    I did ".pro file" with command line "qmake -project", then I use "qmake" and last "make".
    But i got lots and lots of mistakes for some libraries missing.

    I followed this link, That was the way I "prepared" Qt:
    http://sector.ynet.sk/qt4-tutorial/preparations.html

    I don't know what I'm doing wrong, because I can't compile any example in folder "examples" clearly. Is there any other page where I could configure Qt better than that one?

    The problem in my code is the copiler is not able to find "#include<OGLWidget" so I Could not create a "josegl = new OGLWidget". :S
    Last edited by j0rt4g4; 20th November 2008 at 18:51.

  4. #4
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Opengl issue with Qt4.4.3

    Try to do this:
    Qt Code:
    1. qmake -project
    2. qmake "QT += opengl" your_pro_file
    3. make
    To copy to clipboard, switch view to plain text mode 
    I'm a rebel in the S.D.G.

  5. #5
    Join Date
    Nov 2008
    Location
    Caracas - Venezuela
    Posts
    29
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opengl issue with Qt4.4.3

    This is What I get when I want to Add this line: "#include <OGLWidget>" in the "jose.h" and try to copile the way you said:

    Qt Code:
    1. D:\lote3\test>dir
    2. El volumen de la unidad D es G@mes
    3. El número de serie del volumen es: CCAD-7665
    4.  
    5. Directorio de D:\lote3\test
    6.  
    7. 20/11/2008 03:21 p.m. <DIR> .
    8. 20/11/2008 03:21 p.m. <DIR> ..
    9. 20/11/2008 03:18 p.m. 338 11.pro
    10. 20/11/2008 03:18 p.m. <DIR> debug
    11. 06/11/2008 03:54 p.m. 1.445 jose.cpp
    12. 20/11/2008 03:08 p.m. 429 jose.h
    13. 06/11/2008 12:56 p.m. 183 main.cpp
    14. 20/11/2008 03:18 p.m. 5.214 Makefile
    15. 20/11/2008 03:18 p.m. 4.647 Makefile.Debug
    16. 20/11/2008 03:18 p.m. 4.698 Makefile.Release
    17. 20/11/2008 03:11 p.m. <DIR> release
    18. 7 archivos 16.954 bytes
    19. 4 dirs 6.635.053.056 bytes libres
    20.  
    21. D:\lote3\test>qmake -project
    22.  
    23. D:\lote3\test>qmake "QT += opengl" 11.pro
    24.  
    25. D:\lote3\test>make
    26. mingw32-make -f Makefile.Debug
    27. mingw32-make[1]: Entering directory `D:/lote3/test'
    28. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    29. DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEED
    30. S_QMAIN -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4
    31. .4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtOpenG
    32. L" -I"c:\Qt\4.4.3\include\QtOpenGL" -I"c:\Qt\4.4.3\include" -I"." -I"c:\Qt\4.4.3
    33. \include\ActiveQt" -I"debug" -I"." -I"c:\Qt\4.4.3\mkspecs\win32-g++" -o debug\jo
    34. se.o jose.cpp
    35. In file included from jose.cpp:1:
    36. jose.h:11:21: OGLWidget: No such file or directory
    37. mingw32-make[1]: *** [debug/jose.o] Error 1
    38. mingw32-make[1]: Leaving directory `D:/lote3/test'
    39. mingw32-make: *** [debug] Error 2
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Opengl issue with Qt4.4.3

    You are including OGLWidget but it should be QGLWidget.
    I'm a rebel in the S.D.G.

  7. The following user says thank you to lyuts for this useful post:

    j0rt4g4 (20th November 2008)

  8. #7
    Join Date
    Nov 2008
    Location
    Caracas - Venezuela
    Posts
    29
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opengl issue with Qt4.4.3

    Quote Originally Posted by lyuts View Post
    You are including OGLWidget
    but it should be QGLWidget.
    Aren't the same? How it should be ?, Well I see it has the same spelling... Capitals and all...

    PD: Forget it... is "Q"GLWidget ... xD I realized :P I'm going to test it, right now!

    Qt Code:
    1. Setting up a MinGW/Qt only environment...
    2. -- QTDIR set to C:\Qt\4.4.3
    3. -- PATH set to C:\Qt\4.4.3\bin
    4. -- Adding C:\MinGW\bin to PATH
    5. -- Adding C:\WINDOWS\System32 to PATH
    6. -- QMAKESPEC set to win32-g++
    7.  
    8. C:\Qt\4.4.3>cd
    9. D:\lote3\test>qmake -project
    10. D:\lote3\test>qmake
    11. D:\lote3\test>qmake "QT += opengl" test.pro
    12.  
    13. D:\lote3\test>make
    14. mingw32-make -f Makefile.Debug
    15. mingw32-make[1]: Entering directory `D:/lote3/test'
    16. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    17. DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEED
    18. S_QMAIN -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4
    19. .4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtOpenG
    20. L" -I"c:\Qt\4.4.3\include\QtOpenGL" -I"c:\Qt\4.4.3\include" -I"." -I"c:\Qt\4.4.3
    21. \include\ActiveQt" -I"debug" -I"." -I"c:\Qt\4.4.3\mkspecs\win32-g++" -o debug\jo
    22. se.o jose.cpp
    23. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    24. DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEED
    25. S_QMAIN -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4
    26. .4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtOpenG
    27. L" -I"c:\Qt\4.4.3\include\QtOpenGL" -I"c:\Qt\4.4.3\include" -I"." -I"c:\Qt\4.4.3
    28. \include\ActiveQt" -I"debug" -I"." -I"c:\Qt\4.4.3\mkspecs\win32-g++" -o debug\ma
    29. in.o main.cpp
    30. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    31. oc -mthreads -Wl -Wl,-subsystem,windows -o debug\test.exe debug/jose.o debug/mai
    32. n.o -L"c:\Qt\4.4.3\lib" -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmaind
    33. -lQtOpenGLd4 -lQtGuid4 -lQtCored4
    34. C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    35. d -lQtOpenGLd4
    36. collect2: ld returned 1 exit status
    37. mingw32-make[1]: *** [debug\test.exe] Error 1
    38. mingw32-make[1]: Leaving directory `D:/lote3/test'
    39. mingw32-make: *** [debug] Error 2
    40.  
    41. D:\lote3\test>
    To copy to clipboard, switch view to plain text mode 
    this was the response...
    Last edited by j0rt4g4; 20th November 2008 at 21:19.

  9. #8
    Join Date
    Nov 2008
    Location
    Caracas - Venezuela
    Posts
    29
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opengl issue with Qt4.4.3

    How I could resolve this? Anyone has an Idea?
    Qt Code:
    1. C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    2. d -lQtOpenGLd4
    3. collect2: ld returned 1 exit status
    4. mingw32-make[1]: *** [debug\test.exe] Error 1
    5. mingw32-make[1]: Leaving directory `D:/lote3/test'
    6. mingw32-make: *** [debug] Error 2
    To copy to clipboard, switch view to plain text mode 

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opengl issue with Qt4.4.3

    It seems that you don't have the debug versions of Qt libraries. Either build them or build your application in release mode.

  11. #10
    Join Date
    Nov 2008
    Location
    Caracas - Venezuela
    Posts
    29
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opengl issue with Qt4.4.3

    I tr

    Qt Code:
    1. Setting up a MinGW/Qt only environment...
    2. -- QTDIR set to C:\Qt\4.4.3
    3. -- PATH set to C:\Qt\4.4.3\bin
    4. -- Adding C:\MinGW\bin to PATH
    5. -- Adding C:\WINDOWS\System32 to PATH
    6. -- QMAKESPEC set to win32-g++
    7.  
    8. D:\lote3\test>make release
    9. mingw32-make -f Makefile.Release
    10. mingw32-make[1]: Entering directory `D:/lote3/test'
    11. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    12. oc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o release\test.exe release/jose.
    13. o release/main.o -L"c:\Qt\4.4.3\lib" -lopengl32 -lglu32 -lgdi32 -luser32 -lming
    14. w32 -lqtmain -lQtOpenGL4 -lQtGui4 -lQtCore4
    15. C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    16. d -lQtOpenGL4
    17. collect2: ld returned 1 exit status
    18. mingw32-make[1]: *** [release\test.exe] Error 1
    19. mingw32-make[1]: Leaving directory `D:/lote3/test'
    20. mingw32-make: *** [release] Error 2
    21.  
    22. D:\lote3\test>make debug
    23. c:\Qt\4.4.3\bin\qmake.exe -win32 "QT += opengl" -o Makefile test.pro
    24. mingw32-make -f Makefile.Debug
    25. mingw32-make[1]: Entering directory `D:/lote3/test'
    26. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    27. DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEED
    28. S_QMAIN -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4
    29. .4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtOpenG
    30. L" -I"c:\Qt\4.4.3\include\QtOpenGL" -I"c:\Qt\4.4.3\include" -I"." -I"c:\Qt\4.4.3
    31. \include\ActiveQt" -I"debug" -I"." -I"c:\Qt\4.4.3\mkspecs\win32-g++" -o debug\jo
    32. se.o jose.cpp
    33. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    34. DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEED
    35. S_QMAIN -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4.4.3\include\QtCore" -I"c:\Qt\4
    36. .4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtGui" -I"c:\Qt\4.4.3\include\QtOpenG
    37. L" -I"c:\Qt\4.4.3\include\QtOpenGL" -I"c:\Qt\4.4.3\include" -I"." -I"c:\Qt\4.4.3
    38. \include\ActiveQt" -I"debug" -I"." -I"c:\Qt\4.4.3\mkspecs\win32-g++" -o debug\ma
    39. in.o main.cpp
    40. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    41. oc -mthreads -Wl -Wl,-subsystem,windows -o debug\test.exe debug/jose.o debug/mai
    42. n.o -L"c:\Qt\4.4.3\lib" -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmaind
    43. -lQtOpenGLd4 -lQtGuid4 -lQtCored4
    44. C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    45. d -lQtOpenGLd4
    46. collect2: ld returned 1 exit status
    47. mingw32-make[1]: *** [debug\test.exe] Error 1
    48. mingw32-make[1]: Leaving directory `D:/lote3/test'
    49. mingw32-make: *** [debug] Error 2
    50. D:\lote3\test>
    To copy to clipboard, switch view to plain text mode 
    If I tried make release version, i got the same mistake.

    Well i went to Qt dir, then
    >configure
    >mingw32-make
    Last edited by j0rt4g4; 22nd November 2008 at 03:50.

  12. #11
    Join Date
    Nov 2008
    Location
    Caracas - Venezuela
    Posts
    29
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opengl issue with Qt4.4.3

    Quote Originally Posted by j0rt4g4 View Post
    If I tried make release version, i got the same mistake.

    Well i went to Qt dir, then
    >configure
    >mingw32-make
    Well Doing this the problem is GONE!
    In the release and debug mode, both the matter is gone.
    Now If I want to compile, I should do it this way:
    >qmake -project
    >qmake "QT += opengl" test.pro
    >make release or
    >make debug.

    Thank you very much to all.

  13. #12
    Join Date
    Nov 2008
    Posts
    142
    Thanks
    3
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Opengl issue with Qt4.4.3

    Quote Originally Posted by j0rt4g4 View Post
    Now If I want to compile, I should do it this way:
    >qmake -project
    >qmake "QT += opengl" test.pro
    >make release or
    >make debug.
    Just by the way: you can add the line
    Qt Code:
    1. QT += opengl
    To copy to clipboard, switch view to plain text mode 
    to you test.pro file, like it was said before, so you don't have to add it to the qmake command all the time.

  14. #13
    Join Date
    Nov 2008
    Location
    Caracas - Venezuela
    Posts
    29
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opengl issue with Qt4.4.3

    Is there any way I could add the line "QT += opengl" automatically using just "qmake"...

  15. #14
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Opengl issue with Qt4.4.3

    Just open your pro file and add this "QT += opengl" to it. After that you just need qmake and make.
    I'm a rebel in the S.D.G.

Similar Threads

  1. OpenGL and Qt Question
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 18th April 2009, 18:04
  2. QT + OpenGL + Thread => aaaahhhhh !
    By anthibug in forum Qt Programming
    Replies: 7
    Last Post: 26th July 2008, 13:36
  3. QGraphicsView + OpenGL -> Pixmap rendering issue
    By JoergRe in forum Qt Programming
    Replies: 2
    Last Post: 20th May 2008, 18:41
  4. Qtopia Core & OpenGL ES?
    By zelko in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 28th May 2007, 07:21
  5. OpenGl Issue
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 7th April 2007, 05:28

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.