Seite 1 von 1

Kann keine QT+OpenGL Projekte kompilieren

Verfasst: 18. Juli 2009 16:31
von rungaaz
Servus leibe community. (ich bin neu hier)

ich habe das problem, dass ich keine projekte, in denen ich die "QtOpenGL.h" headerdatei einbinde.
ich habe z.B. versucht im QT verzeichnis unter "Examples" die "hellogl" anwendung zu kompilieren. folgendes hat mir das dospromt erzählt:

Code: Alles auswählen

E:\Programme\Qt\4.5.1\examples\opengl\hellogl>comp

E:\Programme\Qt\4.5.1\examples\opengl\hellogl>qmake -project

E:\Programme\Qt\4.5.1\examples\opengl\hellogl>qmake

E:\Programme\Qt\4.5.1\examples\opengl\hellogl>make
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `E:/Programme/Qt/4.5.1/examples/opengl/hello
gl'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..
\..\include\QtCore" -I"..\..\..\include\QtGui" -I"..\..\..\include" -I"." -I"."
-I"..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"." -I"..\..\..\mkspecs
\win32-g++" -o tmp\obj\debug_shared\glwidget.o glwidget.cpp
glwidget.cpp:43:20: QtOpenGL: No such file or directory
In file included from glwidget.cpp:47:
glwidget.h:45:21: QGLWidget: No such file or directory
In file included from glwidget.cpp:47:
glwidget.h:49: error: invalid use of undefined type `struct QGLWidget'
../../../include/QtGui/../../src/gui/image/qpixmap.h:248: error: forward declara
tion of `struct QGLWidget'
glwidget.h:83: error: `GLuint' does not name a type
glwidget.h:84: error: `GLdouble' has not been declared
glwidget.h:84: error: `GLdouble' has not been declared
glwidget.h:84: error: `GLdouble' has not been declared
glwidget.h:84: error: `GLdouble' has not been declared
glwidget.h:85: error: `GLdouble' has not been declared
glwidget.h:85: error: `GLdouble' has not been declared
glwidget.h:85: error: `GLdouble' has not been declared
glwidget.h:85: error: `GLdouble' has not been declared
glwidget.h:85: error: ISO C++ forbids declaration of `x1' with no type
glwidget.h:85: error: ISO C++ forbids declaration of `y1' with no type
glwidget.h:85: error: ISO C++ forbids declaration of `x2' with no type
glwidget.h:85: error: ISO C++ forbids declaration of `y2' with no type
glwidget.h:85: error: ISO C++ forbids declaration of `x3' with no type
glwidget.h:85: error: ISO C++ forbids declaration of `y3' with no type
glwidget.h:85: error: ISO C++ forbids declaration of `x4' with no type
glwidget.h:85: error: ISO C++ forbids declaration of `y4' with no type
glwidget.h:86: error: `GLdouble' has not been declared
glwidget.h:86: error: `GLdouble' has not been declared
glwidget.h:86: error: `GLdouble' has not been declared
glwidget.h:86: error: `GLdouble' has not been declared
glwidget.h:86: error: ISO C++ forbids declaration of `x1' with no type
glwidget.h:86: error: ISO C++ forbids declaration of `y1' with no type
glwidget.h:86: error: ISO C++ forbids declaration of `x2' with no type
glwidget.h:86: error: ISO C++ forbids declaration of `y2' with no type
glwidget.h:89: error: `GLuint' does not name a type
glwidget.h:49: warning: `class GLWidget' has virtual functions but non-virtual d
estructor
glwidget.cpp: In constructor `GLWidget::GLWidget(QWidget*)':
glwidget.cpp:51: error: type `struct QGLWidget' is not a direct base of `GLWidge
t'
glwidget.cpp:53: error: `object' was not declared in this scope
glwidget.cpp:53: warning: unused variable 'object'
glwidget.cpp: In destructor `GLWidget::~GLWidget()':
glwidget.cpp:66: error: `makeCurrent' was not declared in this scope
glwidget.cpp:67: error: `object' was not declared in this scope
glwidget.cpp:67: error: `glDeleteLists' was not declared in this scope
glwidget.cpp:66: warning: unused variable 'makeCurrent'
glwidget.cpp:67: warning: unused variable 'object'
glwidget.cpp:67: warning: unused variable 'glDeleteLists'
glwidget.cpp: In member function `void GLWidget::setXRotation(int)':
glwidget.cpp:93: error: `updateGL' was not declared in this scope
glwidget.cpp:93: warning: unused variable 'updateGL'
glwidget.cpp: In member function `void GLWidget::setYRotation(int)':
glwidget.cpp:104: error: `updateGL' was not declared in this scope
glwidget.cpp:104: warning: unused variable 'updateGL'
glwidget.cpp: In member function `void GLWidget::setZRotation(int)':
glwidget.cpp:114: error: `updateGL' was not declared in this scope
glwidget.cpp:114: warning: unused variable 'updateGL'
glwidget.cpp: In member function `void GLWidget::initializeGL()':
glwidget.cpp:121: error: `qglClearColor' was not declared in this scope
glwidget.cpp:122: error: `object' was not declared in this scope
glwidget.cpp:122: error: `makeObject' was not declared in this scope
glwidget.cpp:123: error: `GL_FLAT' was not declared in this scope
glwidget.cpp:123: error: `glShadeModel' was not declared in this scope
glwidget.cpp:124: error: `GL_DEPTH_TEST' was not declared in this scope
glwidget.cpp:124: error: `glEnable' was not declared in this scope
glwidget.cpp:125: error: `GL_CULL_FACE' was not declared in this scope
glwidget.cpp:121: warning: unused variable 'qglClearColor'
glwidget.cpp:122: warning: unused variable 'object'
glwidget.cpp:122: warning: unused variable 'makeObject'
glwidget.cpp:123: warning: unused variable 'GL_FLAT'
glwidget.cpp:123: warning: unused variable 'glShadeModel'
glwidget.cpp:124: warning: unused variable 'GL_DEPTH_TEST'
glwidget.cpp:125: warning: unused variable 'GL_CULL_FACE'
glwidget.cpp: In member function `void GLWidget::paintGL()':
glwidget.cpp:132: error: `GL_COLOR_BUFFER_BIT' was not declared in this scope
glwidget.cpp:132: error: `GL_DEPTH_BUFFER_BIT' was not declared in this scope
glwidget.cpp:132: error: `glClear' was not declared in this scope
glwidget.cpp:133: error: `glLoadIdentity' was not declared in this scope
glwidget.cpp:134: error: `glTranslated' was not declared in this scope
glwidget.cpp:135: error: `glRotated' was not declared in this scope
glwidget.cpp:138: error: `object' was not declared in this scope
glwidget.cpp:138: error: `glCallList' was not declared in this scope
glwidget.cpp:132: warning: unused variable 'GL_COLOR_BUFFER_BIT'
glwidget.cpp:132: warning: unused variable 'GL_DEPTH_BUFFER_BIT'
glwidget.cpp:132: warning: unused variable 'glClear'
glwidget.cpp:133: warning: unused variable 'glLoadIdentity'
glwidget.cpp:134: warning: unused variable 'glTranslated'
glwidget.cpp:138: warning: unused variable 'object'
glwidget.cpp:138: warning: unused variable 'glCallList'
glwidget.cpp: In member function `void GLWidget::resizeGL(int, int)':
glwidget.cpp:146: error: `glViewport' was not declared in this scope
glwidget.cpp:148: error: `GL_PROJECTION' was not declared in this scope
glwidget.cpp:148: error: `glMatrixMode' was not declared in this scope
glwidget.cpp:149: error: `glLoadIdentity' was not declared in this scope
glwidget.cpp:150: error: `glOrtho' was not declared in this scope
glwidget.cpp:151: error: `GL_MODELVIEW' was not declared in this scope
glwidget.cpp:146: warning: unused variable 'glViewport'
glwidget.cpp:148: warning: unused variable 'GL_PROJECTION'
glwidget.cpp:149: warning: unused variable 'glLoadIdentity'
glwidget.cpp:150: warning: unused variable 'glOrtho'
glwidget.cpp:151: warning: unused variable 'GL_MODELVIEW'
glwidget.cpp: At global scope:
glwidget.cpp:179: error: `GLuint' does not name a type
glwidget.cpp:234: error: variable or field `quad' declared void
glwidget.cpp:234: error: `int GLWidget::quad' is not a static member of `class G
LWidget'
glwidget.cpp:234: error: `GLdouble' was not declared in this scope
glwidget.cpp:234: error: `GLdouble' was not declared in this scope
glwidget.cpp:234: error: `GLdouble' was not declared in this scope
glwidget.cpp:234: error: `GLdouble' was not declared in this scope
glwidget.cpp:235: error: `GLdouble' was not declared in this scope
glwidget.cpp:235: error: `GLdouble' was not declared in this scope
glwidget.cpp:235: error: `GLdouble' was not declared in this scope
glwidget.cpp:235: error: `GLdouble' was not declared in this scope
glwidget.cpp:236: error: initializer expression list treated as compound express
ion
glwidget.cpp:236: error: expected `,' or `;' before '{' token
glwidget.cpp:250: error: variable or field `extrude' declared void
glwidget.cpp:250: error: `int GLWidget::extrude' is not a static member of `clas
s GLWidget'
glwidget.cpp:250: error: `GLdouble' was not declared in this scope
glwidget.cpp:250: error: `GLdouble' was not declared in this scope
glwidget.cpp:250: error: `GLdouble' was not declared in this scope
glwidget.cpp:250: error: `GLdouble' was not declared in this scope
glwidget.cpp:251: error: initializer expression list treated as compound express
ion
glwidget.cpp:251: error: expected `,' or `;' before '{' token
mingw32-make[1]: *** [tmp/obj/debug_shared/glwidget.o] Error 1
mingw32-make[1]: Leaving directory `E:/Programme/Qt/4.5.1/examples/opengl/hellog
l'
mingw32-make: *** [debug-all] Error 2

E:\Programme\Qt\4.5.1\examples\opengl\hellogl>

ich habe absolut keine ahnung was ich dagegen tun kann.
"normale", stinknormale fenster (mit nem label, nem button, etc.) kann ich problemlos kompilieren.


bitte hilfe

mfg rungaaz

[edit]

habe das ganze in codetags gesetzt.

Verfasst: 18. Juli 2009 16:43
von franzf
Bitte verwende das nächste mal Code-Tags, auch für so Compilerausgaben. Ist um Welten übersichtlicher...

Und das Problem:
Das "qmake -project" war überflüssig, und hat dir in dem Fall sogar alles kaputt gemacht. Denn für opengl muss man selber an die mit "qmake -project" autogenerierten .pro-files Hand anlegen. Und genau diese Veränderung hast du wieder gelöscht ;)

Code: Alles auswählen

QT += opengl
In das .pro eintragen sollte apssen.
Hier trotzdem noch der Inhalt des Original-.pro:

Code: Alles auswählen

 HEADERS       = glwidget.h \
                 window.h
 SOURCES       = glwidget.cpp \
                 main.cpp \
                 window.cpp
 QT           += opengl

 # install
 target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl
 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl.pro
 sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl
 INSTALLS += target sources
Schau dir auch noch mal dir Doku an:
http://doc.trolltech.com/4.5/qmake-project-files.html
Für nähere Infos.

Verfasst: 18. Juli 2009 16:56
von rungaaz
DANKE!

einfach nur "QT += opengL" reingeschrieben. und funktioniert prima :D
das mit den codetags mach ich dann das nächstemal.


mfg rungaaz


[edit]

kann ich QT + OpenGL projekte auch in Dev-C++ compilieren?