Sunday, July 20th 2008, 2:27am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

joanna

Beginner

Posts: 4

Location: Philadelphia

1

Wednesday, August 23rd 2006, 11:25pm

[Qt4 + MS Visual Studio 2005] Can't find QtOpenGL

Hi!

I've configured Qt 4 with MS Visual Studio 2005 according to Ian Davis' tutorial. I can build Qt applications but when I try to build OpenGL + Qt applications, something goes wrong...

To begin with, I'm suspecting that I need to link to the OpenGL libs somehow but I can't find the linker in VS2005. How do I do that?

I've done the neccessary changes to the .pro file, so that QT += opengl is included. #include <QtOpenGL> is included in the projectfiles (I'm trying to manipulate the "Grabber" example but I can't build it...).

Basically, what do I need to do to be able to write OpenGL applications with Qt in MS VS2005?

My build output:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
1>------ Build started: Project: saturn, Configuration: Debug Win32 ------
1>Performing Makefile project actions
1>mingw32-make -f Makefile.Debug
1>mingw32-make[1]: Entering directory `c:/Programmering/Cpp/Qt02/saturn/saturn'
1>c:\Qt\4.1.4\bin\uic.exe saturn.ui -o ui_saturn.h
1>g++ -c -g -g -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:/Qt/4.1.4/include/QtCore" -I"C:/Qt/4.1.4/include/QtGui" -I"C:/Qt/4.1.4/include/QtOpenGL" -I"C:/Qt/4.1.4/include" -I"." -I"C:/Qt/4.1.4/include/ActiveQt" -I"debug" -I"." -I"c:\Qt\4.1.4\mkspecs\win32-g++" -o debug\lcdrange.o lcdrange.cpp
1>lcdrange.cpp:45: error: `GLWidget' has not been declared
1>lcdrange.cpp:46: error: ISO C++ forbids declaration of `GLWidget' with no type
1>lcdrange.cpp: In function `int GLWidget(QWidget*)':
1>lcdrange.cpp:46: error: only constructors take base initializers
1>lcdrange.cpp:48: error: `gear1' undeclared (first use this function)
1>lcdrange.cpp:48: error: (Each undeclared identifier is reported only once for each function it appears in.)
1>lcdrange.cpp:49: error: `gear2' undeclared (first use this function)
1>lcdrange.cpp:50: error: `gear3' undeclared (first use this function)
1>lcdrange.cpp:51: error: `xRot' undeclared (first use this function)
1>lcdrange.cpp:52: error: `yRot' undeclared (first use this function)
1>lcdrange.cpp:53: error: `zRot' undeclared (first use this function)
1>lcdrange.cpp:54: error: `gear1Rot' undeclared (first use this function)
1>lcdrange.cpp:56: error: invalid use of `this' in non-member function
1>lcdrange.cpp:57: error: invalid use of `this' in non-member function
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:61: error: expected constructor, destructor, or type conversion before '::' token
1>lcdrange.cpp:61: error: expected `,' or `;' before '::' token
1>lcdrange.cpp:69: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void setXRotation(int)':
1>lcdrange.cpp:71: error: `normalizeAngle' undeclared (first use this function)
1>lcdrange.cpp:72: error: `xRot' undeclared (first use this function)
1>lcdrange.cpp:74: error: `xRotationChanged' undeclared (first use this function)
1>lcdrange.cpp:75: error: `updateGL' undeclared (first use this function)
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:79: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void setYRotation(int)':
1>lcdrange.cpp:81: error: `normalizeAngle' undeclared (first use this function)
1>lcdrange.cpp:82: error: `yRot' undeclared (first use this function)
1>lcdrange.cpp:84: error: `yRotationChanged' undeclared (first use this function)
1>lcdrange.cpp:85: error: `updateGL' undeclared (first use this function)
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:89: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void setZRotation(int)':
1>lcdrange.cpp:91: error: `normalizeAngle' undeclared (first use this function)
1>lcdrange.cpp:92: error: `zRot' undeclared (first use this function)
1>lcdrange.cpp:94: error: `zRotationChanged' undeclared (first use this function)
1>lcdrange.cpp:95: error: `updateGL' undeclared (first use this function)
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:99: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void initializeGL()':
1>lcdrange.cpp:111: error: `gear1' undeclared (first use this function)
1>lcdrange.cpp:111: error: `makeGear' undeclared (first use this function)
1>lcdrange.cpp:112: error: `gear2' undeclared (first use this function)
1>lcdrange.cpp:113: error: `gear3' undeclared (first use this function)
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:118: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void paintGL()':
1>lcdrange.cpp:123: error: `xRot' undeclared (first use this function)
1>lcdrange.cpp:124: error: `yRot' undeclared (first use this function)
1>lcdrange.cpp:125: error: `zRot' undeclared (first use this function)
1>lcdrange.cpp:127: error: `gear1' undeclared (first use this function)
1>lcdrange.cpp:127: error: `gear1Rot' undeclared (first use this function)
1>lcdrange.cpp:127: error: `drawGear' undeclared (first use this function)
1>lcdrange.cpp:128: error: `gear2' undeclared (first use this function)
1>lcdrange.cpp:131: error: `gear3' undeclared (first use this function)
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:136: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp:149: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void mousePressEvent(QMouseEvent*)':
1>lcdrange.cpp:151: error: `lastPos' undeclared (first use this function)
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:154: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void mouseMoveEvent(QMouseEvent*)':
1>lcdrange.cpp:156: error: `lastPos' undeclared (first use this function)
1>lcdrange.cpp:160: error: `xRot' undeclared (first use this function)
1>lcdrange.cpp:161: error: `yRot' undeclared (first use this function)
1>lcdrange.cpp:164: error: `zRot' undeclared (first use this function)
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:169: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void advanceGears()':
1>lcdrange.cpp:171: error: `gear1Rot' undeclared (first use this function)
1>lcdrange.cpp:172: error: `updateGL' undeclared (first use this function)
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:175: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `GLuint makeGear(const GLfloat*, GLdouble, GLdouble, GLdouble, GLdouble, GLint)':
1>lcdrange.cpp:178: error: `GLuint makeGear(const GLfloat*, GLdouble, GLdouble, GLdouble, GLdouble, GLint)' used prior to declaration
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:263: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void drawGear(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)':
1>lcdrange.cpp:265: error: `void drawGear(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)' used prior to declaration
1>lcdrange.cpp: At global scope:
1>lcdrange.cpp:273: error: `GLWidget' is not a class or namespace
1>lcdrange.cpp: In function `void normalizeAngle(int*)':
1>lcdrange.cpp:274: error: `void normalizeAngle(int*)' used prior to declaration
1>lcdrange.cpp:279:2: warning: no newline at end of file
1>mingw32-make[1]: *** [debug\lcdrange.o] Error 1
1>mingw32-make[1]: Leaving directory `c:/Programmering/Cpp/Qt02/saturn/saturn'
1>mingw32-make: *** [debug] Error 2
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Programmering\Cpp\Qt02\saturn\saturn\Debug\BuildLog.htm"
1>saturn - 62 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  • Go to the top of the page

jmw23

Trainee

Posts: 41

Location: Huntsville, AL

Occupation: Software Engineer

2

Friday, August 25th 2006, 10:02pm

RE: [Qt4 + MS Visual Studio 2005] Can't find QtOpenGL

It looks like you are missing the appropriate library files, I code in linux and have not had a similar problem to the one that you are having, but you probably have a wrong path configured in either qt or MS. If not then you may not have the actual libraries (glut, glu, etc...) in which case you need to download and install them. That's about all the help I can give.

-John
  • Go to the top of the page

3

Monday, August 28th 2006, 8:59am

RE: [Qt4 + MS Visual Studio 2005] Can't find QtOpenGL

You need to add "-lopengl32" to the linker options in VS. I don't know where that is offhand, I think somewhere in the Project Options.
It also looks like your #includes are missing something...probably <GL/gl.h> at the very least.
  • Go to the top of the page

Rate this thread