Results 1 to 5 of 5

Thread: Not able to execute in Release Mode

  1. #1
    Join Date
    Aug 2008
    Posts
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Not able to execute in Release Mode

    Hello ,
    I have a small problem with Qt. I am not able to run a simple database program in Relese mode but it works in Debug mode. I have some other widgets which work only in release mode so i have to make it work in release mode itself. I am using Qt integrated with VS .Net (2003). When i run it in release mode it throws an error which is given in Sqlite db connection.h file that (connection is not established). But it works fine in Debug mode i don't get any error. Pls help me out with this problem .


    Thank You

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Not able to execute in Release Mode

    Check for variable initializations and memory handling.

    Usually in debug mode, variables are intialised with default value, but in release it will give garbage. Most common mistake I have encountered

  3. #3
    Join Date
    Aug 2008
    Posts
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Re: Not able to execute in Release Mode

    Hey i checked all the linker paths Include paths every thing is in the right path but still i get the same problem. In debug mode even the database file is created but in release mode after the build is done there is no error exactly but the database file is not created. This is the connection.h code

    Qt Code:
    1. #ifndef CONNECTION_H
    2. #define CONNECTION_H
    3.  
    4. #include <QtGui/QMainWindow>
    5. #include <QtSql>
    6. #include <QMessageBox>
    7. #include <QTableView>
    8.  
    9. inline bool createConnection()
    10. {
    11. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    12. db.setDatabaseName(" LPSC");
    13. if (!db.open())
    14. {
    15. QMessageBox::critical(0, qApp->tr("Cannot open database"),
    16. qApp->tr("Unable to establish a database connection.\n"
    17. "This example needs SQLite support. Please read "
    18. "the Qt SQL driver documentation for information how "
    19. "to build it.\n\n"
    20. "Click Cancel to exit."), QMessageBox::Cancel);
    21. return false;
    22. }
    23. }
    24. #endif
    To copy to clipboard, switch view to plain text mode 

    I even get this warning when i run it on release mode
    Qt Code:
    1. warning C4715: 'createConnection' : not all control paths return a value
    To copy to clipboard, switch view to plain text mode 

    Pls tell me if i am missing some thing or going any where wrong.

    Thank You

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Not able to execute in Release Mode

    rewrite this function like this
    Qt Code:
    1. inline bool createConnection()
    2. {
    3. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    4. db.setDatabaseName(" LPSC");
    5. if (!db.open())
    6. {
    7. QMessageBox::critical(0, qApp->tr("Cannot open database"),
    8. qApp->tr("Unable to establish a database connection.\n"
    9. "This example needs SQLite support. Please read "
    10. "the Qt SQL driver documentation for information how "
    11. "to build it.\n\n"
    12. "Click Cancel to exit."), QMessageBox::Cancel);
    13. return false;
    14. }
    15. return true;
    16. }
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Aug 2008
    Posts
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Re: Problem Solved

    Hey i solved the problem thanks for the reply.
    I had installed qt in C drive and VS.net 2003 in D drive i uninstalled the qt and installed it in D drive it is working fine now.

    thank you

Similar Threads

  1. Widget become black in Release mode
    By navi1084 in forum Qt Programming
    Replies: 5
    Last Post: 21st October 2008, 08:07
  2. QMutex is not working in release mode
    By bitChanger in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2007, 13:32
  3. qodbc driver not loaded error in release mode
    By mandal in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2006, 09:42
  4. Release mode issue
    By stevey in forum Qt Programming
    Replies: 2
    Last Post: 8th November 2006, 20:26
  5. Unable to execute in Debug Mode
    By Kapil in forum Installation and Deployment
    Replies: 38
    Last Post: 5th April 2006, 07:27

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.