<?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[Running Qt Quick and CPP tests at the same time]]></title><description><![CDATA[<p dir="auto">I am trying to run Qt Quick and C++ test at the same time, but I keep getting <code>tst_settings.moc</code> not found.</p>
<p dir="auto">Folder structure looks like this (screenshot):</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/3b6753dc-9806-4069-888b-e97629d99d1b.png" alt="Screenshot 2022-01-27 113117.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><code>*.pro</code> contains:</p>
<pre><code>CONFIG += warn_on qmltestcase

TEMPLATE = app

DISTFILES += \
    tst_idontknow.qml

SOURCES += \
    main.cpp \
    tst_Settings.cpp

INCLUDEPATH += ../&lt;path to external folder&gt;
</code></pre>
<p dir="auto"><code>main.cpp</code> conatins:</p>
<pre><code class="language-cpp">#include &lt;QtQuickTest/quicktest.h&gt;

QUICK_TEST_MAIN(example)
</code></pre>
<p dir="auto"><code>tst_Settings.cpp</code> contains:</p>
<pre><code class="language-cpp">#include &lt;QObject&gt;
#include &lt;QtQuickTest&gt;
#include "App/UserInterface/Settings.h"
#include "App/UserInterface/ErdBridge.h"

class TestSettings: public QObject
{
    Q_OBJECT
public:
    TestSettings();
    ~TestSettings();

    void test_getTimeFormat24hour();
private:
    ErdBridge *erdBridget;
    Settings *settings;

};

TestSettings::TestSettings()
{

    settings = new Settings(erdBridget, nullptr);
}

TestSettings::~TestSettings()
{
    delete settings;
    delete erdBridget;
}

void TestSettings::test_getTimeFormat24hour()
{
    QCOMPARE(settings-&gt;getTimeFormat24hour(), false);
}

QUICK_TEST_MAIN_WITH_SETUP(example, TestSettings)

#include "tst_settings.moc"
</code></pre>
<p dir="auto"><code>tst_idontknow.qml</code> has a generated code, which will always pass. When I run the code I get the following error:</p>
<pre><code>..\Test_cook-ui-modular-qt\tst_Settings.cpp:39:10: fatal error: tst_settings.moc: No such file or directory
   39 | #include "tst_settings.moc"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
mingw32-make[1]: *** [Makefile.Debug:1030: debug/tst_Settings.o] Error 1
mingw32-make[1]: *** Waiting for unfinished jobs....
mingw32-make[1]: Leaving directory 'C:/Users/gollaha/Code/cook-ui-modular-qt/build-Test_cook-ui-modular-qt-Desktop_Qt_6_2_2_MinGW_64_bit-Debug'
mingw32-make: *** [Makefile:45: debug] Error 2
11:29:06: The process "C:\Qt\Tools\mingw900_64\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project Test_cook-ui-modular-qt (kit: Desktop Qt 6.2.2 MinGW 64-bit)
When executing step "Make"
</code></pre>
<p dir="auto">Not sure why I am getting this error. Any help would be appreciated.</p>
]]></description><link>https://forum.qt.io/topic/133879/running-qt-quick-and-cpp-tests-at-the-same-time</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 11:11:27 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/133879.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Jan 2022 22:49:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Running Qt Quick and CPP tests at the same time on Wed, 26 Jan 2022 23:25:46 GMT]]></title><description><![CDATA[<p dir="auto">Upper case vs lower case spelling of test_settings.cpp vs test_Settings.cpp?<br />
Did you run qmake a couple of times as well?  I always have to run qmake a few times to get it to produce the moc file.</p>
]]></description><link>https://forum.qt.io/post/700350</link><guid isPermaLink="true">https://forum.qt.io/post/700350</guid><dc:creator><![CDATA[fcarney]]></dc:creator><pubDate>Wed, 26 Jan 2022 23:25:46 GMT</pubDate></item><item><title><![CDATA[Reply to Running Qt Quick and CPP tests at the same time on Thu, 27 Jan 2022 00:07:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fcarney">@<bdi>fcarney</bdi></a> Ya looks like the uppercase. 🤦‍♂️</p>
<p dir="auto">Thanks for your help.</p>
]]></description><link>https://forum.qt.io/post/700352</link><guid isPermaLink="true">https://forum.qt.io/post/700352</guid><dc:creator><![CDATA[AkshayFP]]></dc:creator><pubDate>Thu, 27 Jan 2022 00:07:05 GMT</pubDate></item><item><title><![CDATA[Reply to Running Qt Quick and CPP tests at the same time on Wed, 26 Jan 2022 23:25:46 GMT]]></title><description><![CDATA[<p dir="auto">Upper case vs lower case spelling of test_settings.cpp vs test_Settings.cpp?<br />
Did you run qmake a couple of times as well?  I always have to run qmake a few times to get it to produce the moc file.</p>
]]></description><link>https://forum.qt.io/post/700350</link><guid isPermaLink="true">https://forum.qt.io/post/700350</guid><dc:creator><![CDATA[fcarney]]></dc:creator><pubDate>Wed, 26 Jan 2022 23:25:46 GMT</pubDate></item></channel></rss>