Results 1 to 3 of 3

Thread: Problem with mixed statically/shared Qt

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    177
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 10 Times in 9 Posts

    Default Re: Problem with mixed statically/shared Qt

    maybe it could be easier if you give us some code.

    anyway, if "QWidget: Must construct a QApplication before a QPaintDevice" is sent, it mostly means, that you didn't construct a QApplication.

    did you write a main file with contents similar to this:
    Qt Code:
    1. #include <QApplication>
    2. #include "MainWindow.h"
    3.  
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. int exec;
    8.  
    9. QApplication app(argc, argv);
    10.  
    11.  
    12. MainWindow mainWindow("Test");
    13. mainWindow.show();
    14.  
    15. exec = app.exec();
    16. return exec;
    17. }
    To copy to clipboard, switch view to plain text mode 

    sry for my bad english!

  2. #2
    Join Date
    Jun 2007
    Posts
    62
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 1 Time in 1 Post

    Unhappy Re: Problem with mixed statically/shared Qt

    Thank you, I did have main file similar to that.

    I managed to solve the problem. As I feared, it was because I was creating an application with Qt statically linked into it, and the application was using a Dll which was using Qt as a shared library.

    So the Dll tried to create some Qt widgets, and the shared Qt library could not find a running instance of a Qt application (because it was hidden in the statically linked main application).

    Because I was in a hurry, I solved the problem by copying all the code in the Dll into my main application, which fixed the problem. A very ugly quick-and-dirty solution, but it worked.

Similar Threads

  1. Replies: 16
    Last Post: 7th March 2006, 15:57

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.