g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include -I. -I. -I. -o quit.o quit.cpp
quit.cpp:2:23: error: APushButton: No such file or directory
quit.cpp: In function ‘int main(int, char**)’:
quit.cpp:7: error: ‘QPushButton’ was not declared in this scope
quit.cpp:7: error: ‘button’ was not declared in this scope
quit.cpp:7: error: expected type-specifier before ‘QPushButton’
quit.cpp:7: error: expected `;' before ‘QPushButton’
make: *** [quit.o] Error 1
Пробовал простой пример с выводом Hello QT! Все работает. Вроде слышал с QT4 есть какието проблемы.
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include -I. -I. -I. -o quit.o quit.cpp
quit.cpp:2:23: error: APushButton: No such file or directory
quit.cpp: In function ‘int main(int, char**)’:
quit.cpp:7: error: ‘QPushButton’ was not declared in this scope
quit.cpp:7: error: ‘button’ was not declared in this scope
quit.cpp:7: error: expected type-specifier before ‘QPushButton’
quit.cpp:7: error: expected `;' before ‘QPushButton’
make: *** [quit.o] Error 1
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include/QtOpenGL -I/usr/include/QtOpenGL -I/usr/include -I/usr/X11R6/include -I. -I. -o OGLQuad.o OGLQuad.cpp
In file included from OGLQuad.cpp:1:
./OGLQuad.h:7: error: expected class-name before ‘{’ token
OGLQuad.cpp: In constructor ‘OGLQuad::OGLQuad(QWidget*)’:
OGLQuad.cpp:2: error: class ‘OGLQuad’ does not have any field named ‘OGLWidget’
OGLQuad.cpp: In member function ‘virtual void OGLQuad::initializeGL()’:
OGLQuad.cpp:8: error: ‘QT’ has not been declared
OGLQuad.cpp:8: error: ‘gglClearColor’ was not declared in this scope
OGLQuad.cpp: At global scope:
OGLQuad.cpp:11: error: no ‘void OGLQuad::resizedGL(int, int)’ member function declared in class ‘OGLQuad’
OGLQuad.cpp: In member function ‘virtual void OGLQuad::paintGL()’:
OGLQuad.cpp:36: error: expected `;' before ‘glEnd’
make: *** [OGLQuad.o] Ошибка 1
Исходный код прилагается.
У вас нет необходимых прав для просмотра вложений в этом сообщении.
#ifndef _OGLQuad_h_
#define _OGLQuad_h_
#include <QGLWidget>
//================================================================================
=========
class OGLQuad : public OGLWidget { /*Откуда взялась OGLWidget?? Есть только QGLWidget*/
protected:
virtual void initializeGL ( );
virtual void resizeGL (int nWidth, int nHeight);
virtual void paintGL ( );
public:
OGLQuad(QWidget* pwgt=0);
};
#endif //_OGLQuad_h_
Та же ерунда и в cpp файле.
Кстати а где main.cpp???
Ich weiss, dass ich nichts weiss, aber wissen Sie es auch?
Завистники на что не взглянут,
подымут вечно лай,
А ты себе своей дорогою ступай,
Полают, да отстанут. Крылов
- > случаем не Qt::black(восьмая строчка cpp)
gglClearColor ->опечатка qglClearColor
OGLQuad.cpp:11: error: no ‘void OGLQuad::resizedGL(int, int)’ member function declared in class ‘OGLQuad’ ->не resizedGL а resizeGL???
Ich weiss, dass ich nichts weiss, aber wissen Sie es auch?
Завистники на что не взглянут,
подымут вечно лай,
А ты себе своей дорогою ступай,
Полают, да отстанут. Крылов
Спасибо! Я после QGLWidget остальные ошибки сам исправил.
P.S. А QGLWidget взялся из невнимательности. Печатаю из книги а там Q очень на O похожа. Вот и пропустил.