Results 1 to 18 of 18

Thread: why linking problem with QGLWidget???

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    103
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    31

    Default Re: why linking problem with QGLWidget???

    Quote Originally Posted by jpn View Post
    Could you show the full compiler command with all the arguments?
    [root@localhost 2and3D]# qmake -project
    //changed .pro file and added QT += opengl
    [root@localhost 2and3D]# qmake
    [root@localhost 2and3D]# make
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/root/qt-x11-opensource-src-4.2.2/mkspecs/linux-g++ -I. \
    -I/usr/local/Trolltech/Qt-4.2.2/include/QtCore -I/usr/local/Trolltech/Qt-4.2.2/include/QtCore -I/usr/local/Trolltech/Qt-4.2.2/include/QtGui \
    -I/usr/local/Trolltech/Qt-4.2.2/include/QtGui -I/usr/local/Trolltech/Qt-4.2.2/include/QtOpenGL -I/usr/local/Trolltech/Qt-4.2.2/include -I. -I/usr/X11R6/include -I. -I. -o form.o form.cpp
    In file included from form.h:5,
    from form.cpp:2:
    glwidget.h:5:30: error: QtOpenGL/QGLWidget: No such file or directory
    glwidget.h:8: error: expected class-name before ‘{’ token
    glwidget.h:36: error: ‘GLuint’ does not name a type
    glwidget.h:37: error: ‘GLdouble’ has not been declared
    glwidget.h:37: error: ‘GLdouble’ has not been declared
    glwidget.h:37: error: ‘GLdouble’ has not been declared
    glwidget.h:37: error: ‘GLdouble’ has not been declared
    glwidget.h:38: error: ‘GLdouble’ has not been declared
    glwidget.h:38: error: ‘GLdouble’ has not been declared
    glwidget.h:38: error: ‘GLdouble’ has not been declared
    glwidget.h:38: error: ‘GLdouble’ has not been declared
    glwidget.h:39: error: ‘GLdouble’ has not been declared
    glwidget.h:39: error: ‘GLdouble’ has not been declared
    glwidget.h:39: error: ‘GLdouble’ has not been declared
    glwidget.h:39: error: ‘GLdouble’ has not been declared
    glwidget.h:42: error: ‘GLuint’ does not name a type
    glwidget.h:8: warning: ‘class GLWidget’ has virtual functions but non-virtual destructor
    form.cpp: In constructor ‘MainWindow::MainWindow(QMainWindow*)â€℠¢:
    form.cpp:41: error: ‘class GLWidget’ has no member named ‘setGeometry’
    make: *** [form.o] Error 1
    [root@localhost 2and3D]#

    [root@localhost ~]# env
    SSH_AGENT_PID=2598
    HOSTNAME=localhost.localdomain
    DESKTOP_STARTUP_ID=
    SHELL=/bin/bash
    TERM=xterm
    HISTSIZE=1000
    GTK_RC_FILES=/etc/gtk/gtkrc:/root/.gtkrc-1.2-gnome2
    WINDOWID=41950507
    QTDIR=/root/qt-x11-opensource-src-4.2.2
    QTINC=/root/qt-x11-opensource-src-4.2.2/include
    USER=root
    LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:s o=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi= 01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com =00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00 ;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;3 1:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz =00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00; 31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;3 5:\
    *.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
    GNOME_KEYRING_SOCKET=/tmp/keyring-lB9HNn/socket
    SSH_AUTH_SOCK=/tmp/ssh-TkJpfF2555/agent.2555
    KDEDIR=/usr
    SESSION_MANAGER=local/localhost.localdomain:/tmp/.ICE-unix/2555
    MAIL=/var/spool/mail/root
    DESKTOP_SESSION=default
    PATH=/root/qt-x11-opensource-src-4.2.2/bin:/root/qt-x11-opensource-src-4.2.2/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:\
    /usr/X11R6/bin:/root/qt-x11-opensource-src-4.2.2/bin:/root/bin
    GDM_XSERVER_LOCATION=local
    INPUTRC=/etc/inputrc
    PWD=/root
    LANG=en_US.UTF-8
    QMAKESPEC=/root/qt-x11-opensource-src-4.2.2/mkspecs/linux-g++
    GDMSESSION=default
    SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
    HOME=/root
    SHLVL=2
    GNOME_DESKTOP_SESSION_ID=Default
    LOGNAME=root
    QTLIB=/root/qt-x11-opensource-src-4.2.2/lib
    CVS_RSH=ssh
    DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-XG0E1vGhF5,guid=752ef945ca242e50a5d2bb9767ffcd00
    LESSOPEN=|/usr/bin/lesspipe.sh %s
    DISPLAY=:0.0
    G_BROKEN_FILENAMES=1
    COLORTERM=gnome-terminal
    XAUTHORITY=/root/.Xauthority
    _=/bin/env
    [root@localhost ~]#
    Last edited by jacek; 15th March 2007 at 11:54. Reason: wrapped too long lines
    I worked on windows Xp with Qt 4.2.2(Open Source Version) and MinGw
    now i am trying the same things on Fedora Core 5 (linux-gcc) and Qt 4.2.2 open source edition.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: why linking problem with QGLWidget???

    well first, you can take QtOpenGL from the include line since qmake adds it ok:
    -I/usr/local/Trolltech/Qt-4.2.2/include/QtOpenGL
    If this doesn't work, it means you didn't install Qt with openGL support.
    Wait a minute, is this where your Qt4 is?:
    QTDIR=/root/qt-x11-opensource-src-4.2.2
    QTINC=/root/qt-x11-opensource-src-4.2.2/include

  3. #3
    Join Date
    Sep 2006
    Posts
    339
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    15
    Thanked 21 Times in 16 Posts

    Default Re: why linking problem with QGLWidget???

    I think the problem is here..
    /usr/local/Trolltech/Qt-4.2.2/include/QtOpenGL---> compiler is serching this path
    QTDIR=/root/qt-x11-opensource-src-4.2.2 ---> Qt is installed here.
    QTINC=/root/qt-x11-opensource-src-4.2.2/include ---> Takes this PATH to include

    I think you need to change the environment settings or uninstall and reinstall Qt again

  4. #4
    Join Date
    Dec 2006
    Posts
    103
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    31

    Default Re: why linking problem with QGLWidget???

    hi all,
    i reinstalled Qt with option -opengl but in the end of ./configure -prefix-install - opengl it gave as :
    ...
    rm -f libQtSvg.so.4.2.2 libQtSvg.so libQtSvg.so.4 libQtSvg.so.4.2
    g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.2.2/lib -Wl,-rpath,/usr/local/Trolltech/Qt-4.2.2/lib -shared -Wl,-soname,libQtSvg.so.4 -o libQtSvg.so.4.2.2 .obj/release-shared/qsvggraphics.o .obj/release-shared/qsvghandler.o .obj/release-shared/qsvgnode.o .obj/release-shared/qsvgstructure.o .obj/release-shared/qsvgstyle.o .obj/release-shared/qsvgfont.o .obj/release-shared/qsvgtinydocument.o .obj/release-shared/qsvgrenderer.o .obj/release-shared/qsvgwidget.o .obj/release-shared/qgraphicssvgitem.o .obj/release-shared/moc_qsvgwidget.o -L/usr/local/Trolltech/Qt-4.2.2/lib -lQtXml -L/usr/local/Trolltech/Qt-4.2.2/lib -lQtGui -L/usr/X11R6/lib -lpng -lSM -lICE -lXrender -lXrandr -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -lglib-2.0 -lpthread -ldl
    ln -s libQtSvg.so.4.2.2 libQtSvg.so
    ln -s libQtSvg.so.4.2.2 libQtSvg.so.4
    ln -s libQtSvg.so.4.2.2 libQtSvg.so.4.2
    rm -f ../../lib/libQtSvg.so.4.2.2
    rm -f ../../lib/libQtSvg.so
    rm -f ../../lib/libQtSvg.so.4
    rm -f ../../lib/libQtSvg.so.4.2
    mv -f libQtSvg.so.4.2.2 libQtSvg.so libQtSvg.so.4 libQtSvg.so.4.2 ../../lib/
    (test -z "../../lib/" || cd "../../lib/" ; targ=`basename libQtSvg.so.4.2.2`; objcopy --only-keep-debug "$targ" "$targ.debug" && objcopy --strip-debug "$targ" && objcopy --add-gnu-debuglink="$targ.debug" "$targ" && chmod -x "$targ.debug" ) ;
    gmake[2]: Leaving directory `/usr/local/Trolltech/Qt-4.2.2/src/svg'
    cd opengl && gmake -f Makefile
    gmake[2]: Entering directory `/usr/local/Trolltech/Qt-4.2.2/src/opengl'
    /usr/local/Trolltech/Qt-4.2.2/bin/qmake -spec ../../mkspecs/linux-g++ -unix -o Makefile opengl.pro
    gmake[2]: Leaving directory `/usr/local/Trolltech/Qt-4.2.2/src/opengl'
    gmake[2]: Entering directory `/usr/local/Trolltech/Qt-4.2.2/src/opengl'
    g++ -c -pipe -g -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_BUILD_OPENGL_LIB -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include/QtCore -I../../include/QtGui -I../../include/QtGui -I../../include -I../../include/QtOpenGL -I/usr/include/freetype2 -I/usr/X11R6/include -I/usr/X11R6/include -I.moc/release-shared -I.uic/release-shared -o .obj/release-shared/qgl.o qgl.cpp
    In file included from qgl.cpp:26:
    qgl.h:60:21: error: GL/glu.h: No such file or directory
    ../../include/QtCore/../../src/corelib/thread/qthreadstorage.h: In static member function ‘static void QThreadStorage<T>::deleteData(void*) [with T = QGLThreadContext*]’:
    ../../include/QtCore/../../src/corelib/thread/qthreadstorage.h:116: instantiated from ‘QThreadStorage<T>::QThreadStorage() [with T = QGLThreadContext*]’
    qgl.cpp:39: instantiated from here
    ../../include/QtCore/../../src/corelib/thread/qthreadstorage.h:113: warning: dereferencing type-punned pointer will break strict-aliasing rules
    gmake[2]: *** [.obj/release-shared/qgl.o] Error 1
    gmake[2]: Leaving directory `/usr/local/Trolltech/Qt-4.2.2/src/opengl'
    gmake[1]: *** [sub-opengl-make_default] Error 2
    gmake[1]: Leaving directory `/usr/local/Trolltech/Qt-4.2.2/src'
    gmake: *** [sub-src-make_default-ordered] Error 2
    [root@localhost Qt-4.2.2]#

    so after tht i did gmake and set QMAKESPEC
    no when i try to run my same program with opengl as:
    qmake -project
    added QT += opengl in .pro file
    qmake
    make [or gmake]
    its giving the error as
    [root@localhost 2and3D]# make
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.2.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.2.2/include/QtCore -I/usr/local/Trolltech/Qt-4.2.2/include/QtCore -I/usr/local/Trolltech/Qt-4.2.2/include/QtGui -I/usr/local/Trolltech/Qt-4.2.2/include/QtGui -I/usr/local/Trolltech/Qt-4.2.2/include/QtOpenGL -I/usr/local/Trolltech/Qt-4.2.2/include/QtOpenGL -I/usr/local/Trolltech/Qt-4.2.2/include -I. -I/usr/X11R6/include -I. -I. -o form.o form.cpp
    In file included from /usr/local/Trolltech/Qt-4.2.2/include/QtOpenGL/qgl.h:1,
    from /usr/local/Trolltech/Qt-4.2.2/include/QtOpenGL/QGLWidget:1,
    from glwidget.h:5,
    from form.h:5,
    from form.cpp:2:
    /usr/local/Trolltech/Qt-4.2.2/include/QtOpenGL/../../src/opengl/qgl.h:60:21: error: GL/glu.h: No such file or directory
    make: *** [form.o] Error 1
    [root@localhost 2and3D]#
    there is no "glu.h" file on my system

    So i think that opengl is not installed. so can u help me that how can i install with opengl?
    Thanks All..
    I worked on windows Xp with Qt 4.2.2(Open Source Version) and MinGw
    now i am trying the same things on Fedora Core 5 (linux-gcc) and Qt 4.2.2 open source edition.

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: why linking problem with QGLWidget???

    error: GL/glu.h: No such file or directory
    it looks like you don't have opengl installed on your system.
    Make sure its installed.
    When you run Qt's configure script, you should read the output configure gives, you will see there if it was able to find opengl or not. (and all other dependencied)

  6. #6
    Join Date
    Dec 2006
    Posts
    103
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    31

    Default Re: why linking problem with QGLWidget???

    Quote Originally Posted by high_flyer View Post
    it looks like you don't have opengl installed on your system.
    Make sure its installed.
    Do i need to install opengl with Qt "qt-x11-opensource-src-4.2.2.tar.gz". i mean it doesn't come with it?
    Quote Originally Posted by high_flyer View Post
    When you run Qt's configure script, you should read the output configure gives, you will see there if it was able to find opengl or not. (and all other dependencied)
    where can i see this configure output file.
    I worked on windows Xp with Qt 4.2.2(Open Source Version) and MinGw
    now i am trying the same things on Fedora Core 5 (linux-gcc) and Qt 4.2.2 open source edition.

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: why linking problem with QGLWidget???

    you can read the configure output when you call configure in your console before you compile Qt.
    If you do ./configure --help, you will get a list with all options.
    One of these option is -opengl or similar.

    I don't know if Qt comes with its own opengl lib src. (can't remember)
    At the configure help, there is a line next to some lib options that says "use system lib" or something similar, for these libs you can choose to use either a system installed lib or to compile the lib from the Qt src.
    I can't remember if opengl is like that or not.

Similar Threads

  1. Problem combining QWorkspace & QGLWidget
    By Nb2Qt in forum Qt Programming
    Replies: 1
    Last Post: 18th December 2006, 21:45
  2. Permission denied error during linking
    By bashamehboob in forum Newbie
    Replies: 2
    Last Post: 15th April 2006, 13:02
  3. QGLWidget renderText problem
    By mbjerkne in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2006, 21:35
  4. Replies: 4
    Last Post: 20th February 2006, 09:11
  5. Runtime dynamic linking + Qt4 problem
    By _Ramirez_ in forum Qt Programming
    Replies: 5
    Last Post: 11th February 2006, 14: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
  •  
Qt is a trademark of The Qt Company.