Jackson.Shredder
17th January 2009, 22:09
Hello, Everyone,
I've got a perplexing problem. I'm following the Qt4 tutorials of interest and while working with the "Hello GL" example ( here (http://doc.trolltech.com/4.1/opengl-hellogl.html) ), I'm getting some linker problems that I can't figure out.
I'm using Fedora 10. I'm using monodevelop to type in the code (no abuse please from you IDE-haters! :D ) and I'm sure that part of the problem is that it doesn't add everything to the qmake Makefile. I'm not 100% familiar with Makefile generation, syntax, etc, but I can noodle out some of the important bits.
Here's the rundown. The errors I'm getting point to a linker error. From what I've been able to determine, I'm either missing or not pointing at the proper qtlib(s). I just can't seem to figure out which ones they are. Here are some of the errors I'm getting:
glwidget.o: In function `GLWidget::InitGL()':
glwidget.cpp:(.text+0x930): undefined reference to `QGLWidget::qglClearColor(QColor const&) const'
And
glwidget.o: In function `GLWidget::~GLWidget()':
glwidget.cpp:(.text+0xbe0): undefined reference to `QGLWidget::makeCurrent()'
Etc.
Also this one's a head scratcher to me as well:
moc_glwidget.o:(.rodata._ZTV8GLWidget[vtable for GLWidget]+0x1c): undefined reference to `QGLWidget::event(QEvent*)'
I saw (on this forum, actually, which is why I'm posting here) this thread:
Can't compile custom class derived from QGLWidget (http://www.qtcentre.org/forum/f-qt-programming-2/t-cant-compile-custom-class-derived-from-qglwidget-7914.html)
I tried this suggestion and it does indeed build, but I get this when I try to run the applicaion:
X Error: BadRequest (invalid request code or no such operation) 1
Extension: 143 (Uknown extension)
Minor opcode: 19 (Unknown request)
Resource id: 0x17
qt-opengl: xcb_io.c:461: _XRead: Assertion `dpy->xcb->reply_data != 0' failed.
Aborted
I don't know what this was supposed to do exactly; but it seemed to fix the 'unresolved externals' problem (yes, I learned dev on Windows/Visual Studio, don't hold it against me! :D )
Here's the LIBS section of my Makefile.
LIBS = $(SUBLIBS) -L/usr/local/Trolltech/Qt-4.4.3/lib -lQtGui -L/usr/l
ocal/Trolltech/Qt-4.4.3/lib -L/usr/X11R6/lib -pthread -lpng -lSM -lICE -pthread
-pthread -lXi -lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtCore -
lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
to which I (manually add) '-L/usr/lib -lGL' to clear the errors like this:
glwidget.o: In function `GLWidget::MakeObject()':
glwidget.cpp:(.text+0x33c): undefined reference to `glGenLists'
I know there's a lot here, and that I'm asking several questions, but are there any suggestions for making this all work? I'm fairly new to the subtleties of development on Linux, though not new to development.
(As an aside, if there's a really good, step by step Makefile tutorial around, point me in the right direction. Most of them I've seen seem to presume some familiarity with them... I want a "this is a mouse this a monitor" level).
I've got a perplexing problem. I'm following the Qt4 tutorials of interest and while working with the "Hello GL" example ( here (http://doc.trolltech.com/4.1/opengl-hellogl.html) ), I'm getting some linker problems that I can't figure out.
I'm using Fedora 10. I'm using monodevelop to type in the code (no abuse please from you IDE-haters! :D ) and I'm sure that part of the problem is that it doesn't add everything to the qmake Makefile. I'm not 100% familiar with Makefile generation, syntax, etc, but I can noodle out some of the important bits.
Here's the rundown. The errors I'm getting point to a linker error. From what I've been able to determine, I'm either missing or not pointing at the proper qtlib(s). I just can't seem to figure out which ones they are. Here are some of the errors I'm getting:
glwidget.o: In function `GLWidget::InitGL()':
glwidget.cpp:(.text+0x930): undefined reference to `QGLWidget::qglClearColor(QColor const&) const'
And
glwidget.o: In function `GLWidget::~GLWidget()':
glwidget.cpp:(.text+0xbe0): undefined reference to `QGLWidget::makeCurrent()'
Etc.
Also this one's a head scratcher to me as well:
moc_glwidget.o:(.rodata._ZTV8GLWidget[vtable for GLWidget]+0x1c): undefined reference to `QGLWidget::event(QEvent*)'
I saw (on this forum, actually, which is why I'm posting here) this thread:
Can't compile custom class derived from QGLWidget (http://www.qtcentre.org/forum/f-qt-programming-2/t-cant-compile-custom-class-derived-from-qglwidget-7914.html)
I tried this suggestion and it does indeed build, but I get this when I try to run the applicaion:
X Error: BadRequest (invalid request code or no such operation) 1
Extension: 143 (Uknown extension)
Minor opcode: 19 (Unknown request)
Resource id: 0x17
qt-opengl: xcb_io.c:461: _XRead: Assertion `dpy->xcb->reply_data != 0' failed.
Aborted
I don't know what this was supposed to do exactly; but it seemed to fix the 'unresolved externals' problem (yes, I learned dev on Windows/Visual Studio, don't hold it against me! :D )
Here's the LIBS section of my Makefile.
LIBS = $(SUBLIBS) -L/usr/local/Trolltech/Qt-4.4.3/lib -lQtGui -L/usr/l
ocal/Trolltech/Qt-4.4.3/lib -L/usr/X11R6/lib -pthread -lpng -lSM -lICE -pthread
-pthread -lXi -lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtCore -
lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
to which I (manually add) '-L/usr/lib -lGL' to clear the errors like this:
glwidget.o: In function `GLWidget::MakeObject()':
glwidget.cpp:(.text+0x33c): undefined reference to `glGenLists'
I know there's a lot here, and that I'm asking several questions, but are there any suggestions for making this all work? I'm fairly new to the subtleties of development on Linux, though not new to development.
(As an aside, if there's a really good, step by step Makefile tutorial around, point me in the right direction. Most of them I've seen seem to presume some familiarity with them... I want a "this is a mouse this a monitor" level).