Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unable to run application in debug mode
Qt 6.11 is out! See what's new in the release blog

Unable to run application in debug mode

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 536 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mcleary
    wrote on last edited by mcleary
    #1

    I am developing a multiplatform application and in Windows I'm using MSVC2015 with Qt5.6

    My application is running just fine in MacOS and Linux both in Debug and Release Modes. However, on Windows I cannot run my application in Debug Mode.

    When I start the debugger I get an error in the following line.
    I have a class that has a static map initialized like this

    static const QMap<QString, PropertyInfo> S_PROPERTY_INFO_MAP =
    {
        {"objectName",          PointCloudData::tr("Objeto")},
    

    If I leave the QMap empty I get the error

    QWidget: Must construct a QApplication before a QWidget
    

    But why my application is running in release mode without problems?

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, I'm guessing the reason your app works in Release mode and on the other platforms is just luck.
      When doing stuff like ::tr("Hello") in static data initialization, i.e. before the QApplication is constructed in your main.cpp, what code gets run in what order is undefined in C++ and Qt is kinda confused before that QApplication is up and running. You could try filling the QMap in a for loop instead.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved