Results 1 to 6 of 6

Thread: extern QWidgetList *qt_modal_stack

  1. #1
    Join Date
    Oct 2008
    Posts
    20
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Arrow extern QWidgetList *qt_modal_stack

    Hi. I was just wondering if it's possible to declare this variable that's used in qapplication.cpp, qapplication_x11.cpp as an extern variable and use it in my code. I need it in order to port old code I wrote for Qt3 to Qt4.

    The problem is when I try to declare it as extern and then link my application, I get error that the qt_modal_stack is unresolved.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 162 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: extern QWidgetList *qt_modal_stack

    well, you can always declare it as extern.
    If noone defines it, though, you end up in that error

    In Qt 4.4.2 such a variable is declared
    Qt Code:
    1. extern QWidgetList *qt_modal_stack;
    To copy to clipboard, switch view to plain text mode 
    therefore your code should link (if you link against the right libs.

    Show us your link command and the error msg, pls.

  3. #3
    Join Date
    Oct 2008
    Posts
    20
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: extern QWidgetList *qt_modal_stack

    D:/Development/IDEs/MinGW/bin/mingw32-make.exe -f Makefile.Debug
    mingw32-make.exe[1]: Entering directory `D:/Development/Projects/Qt4/Item_delegates'
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\Item_delegates.exe debug/ComboDelegate.o debug/main.o debug/MainWidget.o debug/Painter.o debug/moc_ComboDelegate.o debug/moc_MainWidget.o -L"d:\Development\Libraries\QT4\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
    debug/MainWidget.o(.text+0x96b): In function 'ZN10MainWidget10paintEventEP11QPaintEvent':
    D:/Development/Projects/Qt4/Item_delegates/MainWidget.cpp:32: undefined reference to `qt_modal_stack'
    collect2: ld returned 1 exit status
    mingw32-make.exe[1]: *** [debug\Item_delegates.exe] Error 1
    mingw32-make.exe[1]: Leaving directory `D:/Development/Projects/Qt4/Item_delegates'
    D:/Development/IDEs/MinGW/bin/mingw32-make.exe: *** [debug] Error 2

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 162 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: extern QWidgetList *qt_modal_stack

    I'm using linux/X11... so I am not really sure about what the problem is here.
    Have you checked, whether your Qt stuff in put into some namespace?
    (There is the QT_BEGIN_NAMESPACE macro...)
    Perhaps you can check if this variable is in the symbols of your lib (or object file). In linux you could use the nm command.

  5. #5
    Join Date
    Oct 2008
    Posts
    20
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: extern QWidgetList *qt_modal_stack

    It appears that qt shared objects 'so' contain no symbols at all. I used nm command and it found symbols in libraries with debug name only (i.e. libQtGui.so.4.4.2.debug). Then I used "grep 'qt_modal_stack' *" command and the string was found in library libQtGui.so.4.4.2.debug. However when I tried to link with libQtGui.so.4.4.2.debug ld found no qt_modal_stack again.

  6. #6
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 162 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: extern QWidgetList *qt_modal_stack

    maybe the symbol is not exported (newer gcc's have a "visibility" attribute...)

Similar Threads

  1. extern class
    By zorro68 in forum Qt Programming
    Replies: 2
    Last Post: 5th October 2007, 22:08
  2. QWidgetList
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2007, 08:53

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.