Results 1 to 10 of 10

Thread: Getting error on release mode

  1. #1
    Join Date
    Mar 2011
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Getting error on release mode

    Hello,

    I derived a class from QGLWidget, after i add this widget in my application it works well in debug mode if i change to release mode i'm getting this error ;

    Click for see Image

    Do you have any idea about that ?

    Ps Qt Version 4.7 i have booth debug and release libraries ..

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Getting error on release mode

    Do you use some assertions? If yes then probably you are using it wrong!
    I don't see another explanation since erros says that QApplication was not created.
    How you main function looks like?

  3. #3
    Join Date
    Mar 2011
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Getting error on release mode

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4. a.setStyle(new QCleanlooksStyle);
    5. QPixmap pix(":/Images/Splash.png");
    6. SplashScreen Splash(pix,305, 22);
    7. Splash.setMask(pix.mask());
    8. Splash.setWindowOpacity(0);
    9. Splash.show();
    10. for (int i=0; i<100; ++i ) {
    11. Sleep(10);
    12. Splash.setWindowOpacity(i*0.01);
    13. Splash.setMessage(QString("Test : ").append(QString().setNum(i+1)));
    14. }
    15. Initialization(&Splash);
    16.  
    17. [B] MainWindow w;
    18. [/B] w.show();
    19. Splash.finish(&w);
    20.  
    21. return a.exec();
    22. }
    23.  
    24. MainWindow, on this step ;
    25.  
    26. MainWindow::MainWindow(QWidget *parent) :
    27. QMainWindow(parent),
    28. ui(new Ui::MainWindow)
    29. {
    30. [B]ui->setupUi(this);[/B]
    31. .
    32. .
    33. .
    34. }
    35.  
    36. ui_mainwindow.h :
    37.  
    38. glArea = new GLWidget(frmOperation);
    To copy to clipboard, switch view to plain text mode 

    i'm getting error on this step : glArea = new GLWidget(frmOperation);

    but it works well in debug mode ...

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Getting error on release mode

    Show the code of GLWidget constructor. Have you tried to make a clean release build (make clean, qmake, make release) ?

  5. #5
    Join Date
    Mar 2011
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Getting error on release mode

    GLWidget::GLWidget (QWidget *parent) : QGLWidget(parent) {
    }

    There is no code in ctor. I tried clean and rebuikd again and again still getting same error :s

  6. #6
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Getting error on release mode

    Are you including some additional libraries in release mode ? Can we see .pro file ?

  7. The following user says thank you to stampede for this useful post:

    m_brott (24th March 2011)

  8. #7
    Join Date
    Mar 2011
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Getting error on release mode

    I'm using Visual Studio , i double checked compile, linker options it is look like fine. I made simple application just using my GLWidget it works on release and debug, i'm gonna checking project settings again ..


    Added after 14 minutes:


    in QWidget.cpp :

    if (!qApp) {
    qFatal("QWidget: Must construct a QApplication before a QPaintDevice");
    return;
    }

    static QCoreApplication *instance() { return self; }

    qApp (self) is gets NULL in release mode but it gets valid value in debug mode
    Last edited by m_brott; 24th March 2011 at 10:30.

  9. #8
    Join Date
    Mar 2011
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Getting error on release mode

    guys, i stuck with this, is there any idea ?

  10. #9
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Getting error on release mode

    I made simple application just using my GLWidget it works on release and debug, i'm gonna checking project settings again ..
    You got it working already, right ?

  11. #10
    Join Date
    Mar 2011
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Getting error on release mode

    Yay it works atm. Thanks for help ...

Similar Threads

  1. Replies: 1
    Last Post: 2nd November 2009, 13:02
  2. Replies: 9
    Last Post: 15th April 2009, 07:23
  3. Error in exe files in release mode
    By john_god in forum Installation and Deployment
    Replies: 2
    Last Post: 25th January 2009, 12:40
  4. Replies: 8
    Last Post: 10th October 2007, 19:20
  5. qodbc driver not loaded error in release mode
    By mandal in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2006, 10:42

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.