<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Qt Release build application (windows 7) works when invoked with debugger but not standalone]]></title><description><![CDATA[<p dir="auto">I have a project that I am working on using OpenCV. I have both Release and Debug libs (version 3.0 from site) of OpenCV installed. I link to the Release library when building the Release build. I am using a 64bit build of Qt 5.2.1 with VS2012.</p>
<p dir="auto">The gui application crashes straightaway, no gui comes up. The gui is just one window with a couple of buttons and a space to show images.</p>
<p dir="auto">The main entry is this:</p>
<pre><code>int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}
</code></pre>
<p dir="auto">The crash occurs in the moc generated code for setupUI:</p>
<pre><code>void setupUi(QMainWindow *MainWindow)
    {
        if (MainWindow-&gt;objectName().isEmpty())
            MainWindow-&gt;setObjectName(QStringLiteral("MainWindow"));
        MainWindow-&gt;resize(905, 587);
        MainWindow-&gt;setMinimumSize(QSize(0, 340));
        actionQuit = new QAction(MainWindow);
        actionQuit-&gt;setObjectName(QStringLiteral("actionQuit"));
        centralWidget = new QWidget(MainWindow);
        centralWidget-&gt;setObjectName(QStringLiteral("centralWidget"));
        verticalLayout = new QVBoxLayout(centralWidget);
        verticalLayout-&gt;setSpacing(6);
        verticalLayout-&gt;setContentsMargins(11, 11, 11, 11);
        verticalLayout-&gt;setObjectName(QStringLiteral("verticalLayout"));
        widgetScreen = new ImageView(centralWidget);
        widgetScreen-&gt;setObjectName(QStringLiteral("widgetScreen"));
        QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(widgetScreen-&gt;sizePolicy().hasHeightForWidth());
        widgetScreen-&gt;setSizePolicy(sizePolicy);

        verticalLayout-&gt;addWidget(widgetScreen);

        checkBoxFlipRegistration = new QCheckBox(centralWidget);
        checkBoxFlipRegistration-&gt;setObjectName(QStringLiteral("checkBoxFlipRegistration"));
        checkBoxFlipRegistration-&gt;setToolTipDuration(-1);

        verticalLayout-&gt;addWidget(checkBoxFlipRegistration);

        horizontalLayout = new QHBoxLayout();
        horizontalLayout-&gt;setSpacing(6);
        horizontalLayout-&gt;setObjectName(QStringLiteral("horizontalLayout"));
        horizontalLayout-&gt;setContentsMargins(-1, 0, -1, -1);
        pushButtonLoad = new QPushButton(centralWidget);
        pushButtonLoad-&gt;setObjectName(QStringLiteral("pushButtonLoad"));

        horizontalLayout-&gt;addWidget(pushButtonLoad);

        horizontalSpacer = new QSpacerItem(80, 20, QSizePolicy::Minimum, QSizePolicy::Minimum);

        horizontalLayout-&gt;addItem(horizontalSpacer);

        ///////////////////////////////////////////////////////////////////////
        // APPLICATION CRASHES HERE
        pushButtonDesine = new QPushButton(centralWidget);
        pushButtonDesine-&gt;setObjectName(QStringLiteral("pushButtonDesine"));

        horizontalLayout-&gt;addWidget(pushButtonDesine);

        pushButtonExport = new QPushButton(centralWidget);
        pushButtonExport-&gt;setObjectName(QStringLiteral("pushButtonExport"));

        horizontalLayout-&gt;addWidget(pushButtonExport);


        verticalLayout-&gt;addLayout(horizontalLayout);

        MainWindow-&gt;setCentralWidget(centralWidget);
        menuBar = new QMenuBar(MainWindow);
        menuBar-&gt;setObjectName(QStringLiteral("menuBar"));
        menuBar-&gt;setGeometry(QRect(0, 0, 905, 21));
        menuFile = new QMenu(menuBar);
        menuFile-&gt;setObjectName(QStringLiteral("menuFile"));
        MainWindow-&gt;setMenuBar(menuBar);
        statusBar = new QStatusBar(MainWindow);
        statusBar-&gt;setObjectName(QStringLiteral("statusBar"));
        MainWindow-&gt;setStatusBar(statusBar);

        menuBar-&gt;addAction(menuFile-&gt;menuAction());
        menuFile-&gt;addAction(actionQuit);

        retranslateUi(MainWindow);
        QObject::connect(actionQuit, SIGNAL(triggered()), MainWindow, SLOT(close()));

        QMetaObject::connectSlotsByName(MainWindow);
    }
</code></pre>
<p dir="auto">I've seen similar problems occur when I have failed to initialize my objects correctly, but in those cases I would see a crash in the Release build whether I ran it from the debugger or standalone. It doesn't look like an OpenCV debug/release issue as we don't even get to code that loads that library.</p>
<p dir="auto">Does anyone have any thoughts on what to do next? I'm stumped.</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/topic/91376/qt-release-build-application-windows-7-works-when-invoked-with-debugger-but-not-standalone</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 17:43:54 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/91376.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 05 Jun 2018 21:12:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt Release build application (windows 7) works when invoked with debugger but not standalone on Thu, 07 Jun 2018 14:49:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/krp1">@<bdi>KRP1</bdi></a><br />
Lucky you didn't have other <code>#include</code>s with <code>struct</code>s in that source file!  And just as well you spotted it anyway :)</p>
]]></description><link>https://forum.qt.io/post/462526</link><guid isPermaLink="true">https://forum.qt.io/post/462526</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 07 Jun 2018 14:49:34 GMT</pubDate></item><item><title><![CDATA[Reply to Qt Release build application (windows 7) works when invoked with debugger but not standalone on Thu, 07 Jun 2018 13:48:53 GMT]]></title><description><![CDATA[<p dir="auto">Compiler flags turns out to be the source of the problem, or rather a pragma I had for aligning a data structure generated from hardware.</p>
<p dir="auto">I had:</p>
<pre><code>#pragma pack(1)

#include "hardware_struct.h"
</code></pre>
<p dir="auto">This was never reset. The fix.</p>
<pre><code>#pragma pack(push, 1)

#include "hardware_struct.h"

#pragma pack(pop)
</code></pre>
<p dir="auto">Thanks for your help.</p>
]]></description><link>https://forum.qt.io/post/462518</link><guid isPermaLink="true">https://forum.qt.io/post/462518</guid><dc:creator><![CDATA[KRP1]]></dc:creator><pubDate>Thu, 07 Jun 2018 13:48:53 GMT</pubDate></item><item><title><![CDATA[Reply to Qt Release build application (windows 7) works when invoked with debugger but not standalone on Wed, 06 Jun 2018 18:29:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/krp1">@<bdi>KRP1</bdi></a><br />
any special compiler flags you set in your .pro file?</p>
<p dir="auto">Otherwise try to delete the build directory and build it again</p>
]]></description><link>https://forum.qt.io/post/462291</link><guid isPermaLink="true">https://forum.qt.io/post/462291</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Wed, 06 Jun 2018 18:29:48 GMT</pubDate></item><item><title><![CDATA[Reply to Qt Release build application (windows 7) works when invoked with debugger but not standalone on Wed, 06 Jun 2018 14:30:18 GMT]]></title><description><![CDATA[<p dir="auto">I ran dependency walker and was able to resolve all the dlls correctly. I ran windeployqt and copied the remaining non-standard dlls by hand (opencv and litezip).</p>
<p dir="auto">I had commented the ui setup code to show exactly where the program crashes but you may not have noticed because you have to scroll to see the comment.</p>
<p dir="auto">To drill down further, I ran the release version and attached to QtCreator when it crashed. Here is the stack trace and loaded module information:</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/66a504a7-cfa5-4554-b4b5-6c9854ba4c97.png" alt="0_1528295245959_FlimRegStackTrace.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Any ideas on why this is crashing here? When I run the code from the debugger (cdb), the same modules as listed above are loaded but it doesn't crash.</p>
]]></description><link>https://forum.qt.io/post/462255</link><guid isPermaLink="true">https://forum.qt.io/post/462255</guid><dc:creator><![CDATA[KRP1]]></dc:creator><pubDate>Wed, 06 Jun 2018 14:30:18 GMT</pubDate></item><item><title><![CDATA[Reply to Qt Release build application (windows 7) works when invoked with debugger but not standalone on Wed, 06 Jun 2018 09:23:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/krp1">@<bdi>KRP1</bdi></a><br />
maybe your application is missing a dependency it cannot find outside QtCreator?<br />
Check with <a href="http://www.dependencywalker.com/" target="_blank" rel="noopener noreferrer nofollow ugc">DependencyWalker</a>.</p>
]]></description><link>https://forum.qt.io/post/462162</link><guid isPermaLink="true">https://forum.qt.io/post/462162</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Wed, 06 Jun 2018 09:23:44 GMT</pubDate></item></channel></rss>