Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. German
  4. Qt-Unit-Test lässt sich nicht auführen
Forum Updated to NodeBB v4.3 + New Features

Qt-Unit-Test lässt sich nicht auführen

Scheduled Pinned Locked Moved Unsolved German
12 Posts 2 Posters 4.0k 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.
  • Try2BeatusT Offline
    Try2BeatusT Offline
    Try2Beatus
    wrote on last edited by
    #3

    Hier nochmal ein richtiger Screen.
    http://imgur.com/a/utvUZ

    Habe schon rum probiert, aber kein erfolg gehabt.

    K 1 Reply Last reply
    0
    • Try2BeatusT Try2Beatus

      Hier nochmal ein richtiger Screen.
      http://imgur.com/a/utvUZ

      Habe schon rum probiert, aber kein erfolg gehabt.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #4

      @Try2Beatus

      Versuche ein neues Test-Projekt vom Template in Qt creator aufzusetzen und zu starten. Das sollte funktionieren und laufen. Da wird zwar noch nichts getestet, aber es gibt dir dann eine Basis zum Weitermachen.

      Wenn ich die Datei in dem Projekt richtig interpretiere, dann versuchst du ein Testsetup mit dem normalen Source zu kombinieren. Das läuft so nicht. Im Testsetup gibt es kein Programm main, wie in einem normalen Fall. Deshalb mein Vorschlag oben, damit siehst wie es laufen sollte. Du kannst dann einfach eine Klasse mit den Lauf nehmen und diese Testen.

      Wahrscheinlich musst du nur main.cpp aus dem .pro file nehmen oder mit einem '#' als qmake Kommentar markieren. Dann solltest du deine Klasse in game testen können. Dies setzt allerdings voraus, dass du nicht alles mal in main.cpp und game.* wild verteilt hast.

      Vote the answer(s) that helped you to solve your issue(s)

      Try2BeatusT 1 Reply Last reply
      1
      • K koahnig

        @Try2Beatus

        Versuche ein neues Test-Projekt vom Template in Qt creator aufzusetzen und zu starten. Das sollte funktionieren und laufen. Da wird zwar noch nichts getestet, aber es gibt dir dann eine Basis zum Weitermachen.

        Wenn ich die Datei in dem Projekt richtig interpretiere, dann versuchst du ein Testsetup mit dem normalen Source zu kombinieren. Das läuft so nicht. Im Testsetup gibt es kein Programm main, wie in einem normalen Fall. Deshalb mein Vorschlag oben, damit siehst wie es laufen sollte. Du kannst dann einfach eine Klasse mit den Lauf nehmen und diese Testen.

        Wahrscheinlich musst du nur main.cpp aus dem .pro file nehmen oder mit einem '#' als qmake Kommentar markieren. Dann solltest du deine Klasse in game testen können. Dies setzt allerdings voraus, dass du nicht alles mal in main.cpp und game.* wild verteilt hast.

        Try2BeatusT Offline
        Try2BeatusT Offline
        Try2Beatus
        wrote on last edited by
        #5

        @koahnig

        Ich habe jetzt mal ein komplett neues Qt-Unit-Test Projekt angelegt und ausgeführt. Es kommt immer noch der selbe Fehler.

        Screenshot:

        Normal müsste das alte Projekt so auch funktionieren, da es in der Schule (unter OpenSuse) auch läuft, deswegen wundert es mich ja, dass es unter Windows nicht läuft. Die main.cpp ist am rande komplett leer. Eigentlich überflüssig.

        K 2 Replies Last reply
        0
        • Try2BeatusT Try2Beatus

          @koahnig

          Ich habe jetzt mal ein komplett neues Qt-Unit-Test Projekt angelegt und ausgeführt. Es kommt immer noch der selbe Fehler.

          Screenshot:

          Normal müsste das alte Projekt so auch funktionieren, da es in der Schule (unter OpenSuse) auch läuft, deswegen wundert es mich ja, dass es unter Windows nicht läuft. Die main.cpp ist am rande komplett leer. Eigentlich überflüssig.

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #6

          @Try2Beatus

          Hier sind die Dateien und Ausgabe eines Laufes mit Template von meinem Rechner.

          #-------------------------------------------------
          #
          # Project created by QtCreator 2017-04-30T12:16:51
          #
          #-------------------------------------------------
          
          QT       += testlib
          
          QT       -= gui
          
          TARGET = tst_UnitTestTemplateTest
          CONFIG   += console
          CONFIG   -= app_bundle
          
          TEMPLATE = app
          
          # The following define makes your compiler emit warnings if you use
          # any feature of Qt which as been marked as deprecated (the exact warnings
          # depend on your compiler). Please consult the documentation of the
          # deprecated API in order to know how to port your code away from it.
          DEFINES += QT_DEPRECATED_WARNINGS
          
          # You can also make your code fail to compile if you use deprecated APIs.
          # In order to do so, uncomment the following line.
          # You can also select to disable deprecated APIs only up to a certain version of Qt.
          #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
          
          
          SOURCES += tst_UnitTestTemplateTest.cpp
          DEFINES += SRCDIR=\\\"$$PWD/\\\"
          
          #include <QString>
          #include <QtTest>
          
          class UnitTestTemplateTest : public QObject
          {
              Q_OBJECT
          
          public:
              UnitTestTemplateTest();
          
          private Q_SLOTS:
              void testCase1();
          };
          
          UnitTestTemplateTest::UnitTestTemplateTest()
          {
          }
          
          void UnitTestTemplateTest::testCase1()
          {
              QVERIFY2(true, "Failure");
          }
          
          QTEST_APPLESS_MAIN(UnitTestTemplateTest)
          
          #include "tst_UnitTestTemplateTest.moc"
          

          Und das Kompilierenfenster

          12:17:44: Running steps for project UnitTestTemplate...
          12:17:44: Starting: "C:\Qt\5.4\mingw491_32\bin\qmake.exe" C:\Source\UnitTestTemplate\UnitTestTemplate.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
          Qt: Untested Windows version 10.0 detected!
          12:17:46: The process "C:\Qt\5.4\mingw491_32\bin\qmake.exe" exited normally.
          12:17:46: Starting: "C:\Qt\Tools\mingw491_32\bin\mingw32-make.exe" qmake_all
          mingw32-make: Nothing to be done for 'qmake_all'.
          12:17:47: The process "C:\Qt\Tools\mingw491_32\bin\mingw32-make.exe" exited normally.
          12:17:47: Starting: "C:\Qt\Tools\mingw491_32\bin\mingw32-make.exe" 
          C:/Qt/Tools/mingw491_32/bin/mingw32-make -f Makefile.Debug
          mingw32-make[1]: Entering directory 'c:/Source/Shadows/build-UnitTestTemplate-Desktop_Qt_5_4_2_MinGW_32bit3-Debug'
          C:\Qt\5.4\mingw491_32\bin\moc.exe -DUNICODE -DQT_DEPRECATED_WARNINGS -DSRCDIR=\"C:/Source/UnitTestTemplate/\" -DQT_QML_DEBUG -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR=\"C:/Source/Shadows/build-UnitTestTemplate-Desktop_Qt_5_4_2_MinGW_32bit3-Debug\" -D__GNUC__ -DWIN32 -IC:/Qt/5.4/mingw491_32/mkspecs/win32-g++ -IC:/Source/UnitTestTemplate -IC:/Qt/5.4/mingw491_32/include -IC:/Qt/5.4/mingw491_32/include/QtTest -IC:/Qt/5.4/mingw491_32/include/QtCore -I. -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include-fixed -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++ -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32 -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward ..\..\UnitTestTemplate\tst_UnitTestTemplateTest.cpp -o debug\tst_UnitTestTemplateTest.moc
          Qt: Untested Windows version 10.0 detected!
          g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_DEPRECATED_WARNINGS -DSRCDIR=\"C:/Source/UnitTestTemplate/\" -DQT_QML_DEBUG -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR=\"C:/Source/Shadows/build-UnitTestTemplate-Desktop_Qt_5_4_2_MinGW_32bit3-Debug\" -I"..\..\UnitTestTemplate" -I"." -I"..\..\..\Qt\5.4\mingw491_32\include" -I"..\..\..\Qt\5.4\mingw491_32\include\QtTest" -I"..\..\..\Qt\5.4\mingw491_32\include\QtCore" -I"debug" -I"..\..\..\Qt\5.4\mingw491_32\mkspecs\win32-g++"  -o debug\tst_UnitTestTemplateTest.o ..\..\UnitTestTemplate\tst_UnitTestTemplateTest.cpp
          g++ -Wl,-subsystem,console -mthreads -o debug\tst_UnitTestTemplateTest.exe debug/tst_UnitTestTemplateTest.o  -LC:/Qt/5.4/mingw491_32/lib -lQt5Testd -lQt5Cored 
          mingw32-make[1]: Leaving directory 'c:/Source/Shadows/build-UnitTestTemplate-Desktop_Qt_5_4_2_MinGW_32bit3-Debug'
          12:17:56: The process "C:\Qt\Tools\mingw491_32\bin\mingw32-make.exe" exited normally.
          12:17:56: Elapsed time: 00:13.
          

          Die Windows 10 Warnung ist unerheblich und kommt von Qt 5.4, das ich immer noch verwende.

          Bei dir ist ein Problem mit dem allerersten Schritt moc-compiler.

          Irgendetwas ist dem Setup nicht in Ordnung. Poste am Besten einmal den gesamten Inhalt des letzten Kompilerlaufes. Dieser sollte sogar noch kürzer sein als mein Beispiel. Die Ausgabe kannst mit ctrl+c und ctrl+v hier in das Forum bringen. Der rechte Button oberhalb des Eingabefensters setzt dir die Zeichen für das Code-Wrapping.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          1
          • Try2BeatusT Try2Beatus

            @koahnig

            Ich habe jetzt mal ein komplett neues Qt-Unit-Test Projekt angelegt und ausgeführt. Es kommt immer noch der selbe Fehler.

            Screenshot:

            Normal müsste das alte Projekt so auch funktionieren, da es in der Schule (unter OpenSuse) auch läuft, deswegen wundert es mich ja, dass es unter Windows nicht läuft. Die main.cpp ist am rande komplett leer. Eigentlich überflüssig.

            K Offline
            K Offline
            koahnig
            wrote on last edited by
            #7

            @Try2Beatus

            Noch ein paar Details zu deinem OS. Welche Windows Version?

            Hast du den Online-Installer verwendet?
            Welche Qt version verwendest du?
            Qt 5.8.9 sollte es nicht geben. Da liegt wohl ein Tippfehler vor.

            Hast du extra irgendwelche Veränderungen an einem Windows-Environment (Umgebung) in Bezug auf Qt-Pfade oder den MinGW-Compilern gemacht?

            Vote the answer(s) that helped you to solve your issue(s)

            Try2BeatusT 2 Replies Last reply
            0
            • K koahnig

              @Try2Beatus

              Noch ein paar Details zu deinem OS. Welche Windows Version?

              Hast du den Online-Installer verwendet?
              Welche Qt version verwendest du?
              Qt 5.8.9 sollte es nicht geben. Da liegt wohl ein Tippfehler vor.

              Hast du extra irgendwelche Veränderungen an einem Windows-Environment (Umgebung) in Bezug auf Qt-Pfade oder den MinGW-Compilern gemacht?

              Try2BeatusT Offline
              Try2BeatusT Offline
              Try2Beatus
              wrote on last edited by Try2Beatus
              #8

              @koahnig

              Windows Version: Windows 10 Pro 64-Bit-Version (10.0, Build 14393)
              Install Art: Online Installer verwendet
              Qt-Version: Qt 5.8.0

              Ich habe keine Änderungen vorgenommen. Beim installieren habe ich alles standard gelassen.

              1 Reply Last reply
              0
              • K koahnig

                @Try2Beatus

                Noch ein paar Details zu deinem OS. Welche Windows Version?

                Hast du den Online-Installer verwendet?
                Welche Qt version verwendest du?
                Qt 5.8.9 sollte es nicht geben. Da liegt wohl ein Tippfehler vor.

                Hast du extra irgendwelche Veränderungen an einem Windows-Environment (Umgebung) in Bezug auf Qt-Pfade oder den MinGW-Compilern gemacht?

                Try2BeatusT Offline
                Try2BeatusT Offline
                Try2Beatus
                wrote on last edited by Try2Beatus
                #9

                @koahnig

                Kompiler Infos

                15:50:35: Führe Schritte für Projekt TestUnit aus...
                15:50:35: Starte "C:\Qt\5.8\mingw53_32\bin\qmake.exe" "C:\Users\Marvin Wilcke\Documents\TestUnit\TestUnit.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
                Info: creating stash file C:\Users\Marvin Wilcke\Documents\TestUnit\.qmake.stash
                15:50:35: Der Prozess "C:\Qt\5.8\mingw53_32\bin\qmake.exe" wurde normal beendet.
                15:50:35: Starte "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" qmake_all
                mingw32-make: Nothing to be done for 'qmake_all'.
                15:50:36: Der Prozess "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" wurde normal beendet.
                15:50:36: Starte "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" 
                C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
                mingw32-make[1]: Entering directory 'C:/Users/Marvin Wilcke/Documents/TestUnit'
                g++ -pipe -fno-keep-inline-dllexport -g -std=gnu++11 -frtti -Wall -Wextra -dM -E -o debug\moc_predefs.h ..\..\..\..\Qt\5.8\mingw53_32\mkspecs\features\data\dummy.cpp
                C:\Qt\5.8\mingw53_32\bin\moc.exe -DUNICODE -DQT_DEPRECATED_WARNINGS -DSRCDIR=\"C:/Users/Marvin Wilcke/Documents/TestUnit/\" -DQT_QML_DEBUG -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR="\"C:/Users/Marvin Wilcke/Documents/TestUnit\"" --include debug/moc_predefs.h -IC:/Qt/5.8/mingw53_32/mkspecs/win32-g++ -I"C:/Users/Marvin Wilcke/Documents/TestUnit" -IC:/Qt/5.8/mingw53_32/include -IC:/Qt/5.8/mingw53_32/include/QtTest -IC:/Qt/5.8/mingw53_32/include/QtCore -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include-fixed -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++ -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32 -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward tst_testunittest.cpp -o debug\tst_testunittest.moc
                Usage: C:\Qt\5.8\mingw53_32\bin\moc.exe [options] [header-file] [@option-file]
                Qt Meta Object Compiler version 67 (Qt 5.8.0)
                
                Options:
                  -?, -h, --help              Displays this help.
                  -v, --version               Displays version information.
                  -o <file>                   Write output to file rather than stdout.
                  -I <dir>                    Add dir to the include path for header files.
                  -F <framework>              Add Mac framework to the include path for header
                                              files.
                  -E                          Preprocess only; do not generate meta object
                                              code.
                  -D <macro[=def]>            Define macro, with optional definition.
                  -U <macro>                  Undefine macro.
                  -M <key=value>              Add key/value pair to plugin meta data
                  --compiler-flavor <flavor>  Set the compiler flavor: either "msvc" or "unix".
                  -i                          Do not generate an #include statement.
                  -p <path>                   Path prefix for included file.
                  -f <file>                   Force #include <file> (overwrite default).
                  -b <file>                   Prepend #include <file> (preserve default
                                              include).
                  --include <file>            Parse <file> as an #include before the main
                                              source(s).
                  -n <which>                  Do not display notes (-nn) or warnings (-nw).
                                              Compatibility option.
                  --no-notes                  Do not display notes.
                  --no-warnings               Do not display warnings (implies --no-notes).
                  --ignore-option-clashes     Ignore all options that conflict with compilers,
                                              like -pthread conflicting with moc's -p option.
                
                Arguments:
                  [header-file]               Header file to read from, otherwise stdin.
                  [@option-file]              Read additional options from option-file.
                moc: Too many input files specified: 'Wilcke/Documents/TestUnit/"' 'tst_testunittest.cpp'
                Makefile.Debug:384: recipe for target 'debug/tst_testunittest.moc' failed
                mingw32-make[1]: Leaving directory 'C:/Users/Marvin Wilcke/Documents/TestUnit'
                Makefile:34: recipe for target 'debug' failed
                mingw32-make[1]: *** [debug/tst_testunittest.moc] Error 1
                mingw32-make: *** [debug] Error 2
                15:50:36: Der Prozess "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" wurde mit dem Rückgabewert 2 beendet.
                Fehler beim Erstellen/Deployment des Projekts TestUnit (Kit: Desktop Qt 5.8.0 MinGW 32bit)
                Bei der Ausführung von Schritt "Make"
                15:50:36: Verstrichene Zeit: 00:02.
                

                .pro

                #-------------------------------------------------
                #
                # Project created by QtCreator 2017-04-30T15:50:30
                #
                #-------------------------------------------------
                
                QT       += testlib
                
                QT       -= gui
                
                TARGET = tst_testunittest
                CONFIG   += console
                CONFIG   -= app_bundle
                
                TEMPLATE = app
                
                # The following define makes your compiler emit warnings if you use
                # any feature of Qt which as been marked as deprecated (the exact warnings
                # depend on your compiler). Please consult the documentation of the
                # deprecated API in order to know how to port your code away from it.
                DEFINES += QT_DEPRECATED_WARNINGS
                
                # You can also make your code fail to compile if you use deprecated APIs.
                # In order to do so, uncomment the following line.
                # You can also select to disable deprecated APIs only up to a certain version of Qt.
                #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                
                
                SOURCES += tst_testunittest.cpp
                DEFINES += SRCDIR=\\\"$$PWD/\\\"
                

                tst_...cpp

                #include <QString>
                #include <QtTest>
                
                class TestUnitTest : public QObject
                {
                    Q_OBJECT
                
                public:
                    TestUnitTest();
                
                private Q_SLOTS:
                    void testCase1();
                };
                
                TestUnitTest::TestUnitTest()
                {
                }
                
                void TestUnitTest::testCase1()
                {
                    QVERIFY2(true, "Failure");
                }
                
                QTEST_APPLESS_MAIN(TestUnitTest)
                
                #include "tst_testunittest.moc"
                
                K 1 Reply Last reply
                0
                • Try2BeatusT Try2Beatus

                  @koahnig

                  Kompiler Infos

                  15:50:35: Führe Schritte für Projekt TestUnit aus...
                  15:50:35: Starte "C:\Qt\5.8\mingw53_32\bin\qmake.exe" "C:\Users\Marvin Wilcke\Documents\TestUnit\TestUnit.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
                  Info: creating stash file C:\Users\Marvin Wilcke\Documents\TestUnit\.qmake.stash
                  15:50:35: Der Prozess "C:\Qt\5.8\mingw53_32\bin\qmake.exe" wurde normal beendet.
                  15:50:35: Starte "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" qmake_all
                  mingw32-make: Nothing to be done for 'qmake_all'.
                  15:50:36: Der Prozess "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" wurde normal beendet.
                  15:50:36: Starte "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" 
                  C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
                  mingw32-make[1]: Entering directory 'C:/Users/Marvin Wilcke/Documents/TestUnit'
                  g++ -pipe -fno-keep-inline-dllexport -g -std=gnu++11 -frtti -Wall -Wextra -dM -E -o debug\moc_predefs.h ..\..\..\..\Qt\5.8\mingw53_32\mkspecs\features\data\dummy.cpp
                  C:\Qt\5.8\mingw53_32\bin\moc.exe -DUNICODE -DQT_DEPRECATED_WARNINGS -DSRCDIR=\"C:/Users/Marvin Wilcke/Documents/TestUnit/\" -DQT_QML_DEBUG -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR="\"C:/Users/Marvin Wilcke/Documents/TestUnit\"" --include debug/moc_predefs.h -IC:/Qt/5.8/mingw53_32/mkspecs/win32-g++ -I"C:/Users/Marvin Wilcke/Documents/TestUnit" -IC:/Qt/5.8/mingw53_32/include -IC:/Qt/5.8/mingw53_32/include/QtTest -IC:/Qt/5.8/mingw53_32/include/QtCore -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include-fixed -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++ -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32 -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward tst_testunittest.cpp -o debug\tst_testunittest.moc
                  Usage: C:\Qt\5.8\mingw53_32\bin\moc.exe [options] [header-file] [@option-file]
                  Qt Meta Object Compiler version 67 (Qt 5.8.0)
                  
                  Options:
                    -?, -h, --help              Displays this help.
                    -v, --version               Displays version information.
                    -o <file>                   Write output to file rather than stdout.
                    -I <dir>                    Add dir to the include path for header files.
                    -F <framework>              Add Mac framework to the include path for header
                                                files.
                    -E                          Preprocess only; do not generate meta object
                                                code.
                    -D <macro[=def]>            Define macro, with optional definition.
                    -U <macro>                  Undefine macro.
                    -M <key=value>              Add key/value pair to plugin meta data
                    --compiler-flavor <flavor>  Set the compiler flavor: either "msvc" or "unix".
                    -i                          Do not generate an #include statement.
                    -p <path>                   Path prefix for included file.
                    -f <file>                   Force #include <file> (overwrite default).
                    -b <file>                   Prepend #include <file> (preserve default
                                                include).
                    --include <file>            Parse <file> as an #include before the main
                                                source(s).
                    -n <which>                  Do not display notes (-nn) or warnings (-nw).
                                                Compatibility option.
                    --no-notes                  Do not display notes.
                    --no-warnings               Do not display warnings (implies --no-notes).
                    --ignore-option-clashes     Ignore all options that conflict with compilers,
                                                like -pthread conflicting with moc's -p option.
                  
                  Arguments:
                    [header-file]               Header file to read from, otherwise stdin.
                    [@option-file]              Read additional options from option-file.
                  moc: Too many input files specified: 'Wilcke/Documents/TestUnit/"' 'tst_testunittest.cpp'
                  Makefile.Debug:384: recipe for target 'debug/tst_testunittest.moc' failed
                  mingw32-make[1]: Leaving directory 'C:/Users/Marvin Wilcke/Documents/TestUnit'
                  Makefile:34: recipe for target 'debug' failed
                  mingw32-make[1]: *** [debug/tst_testunittest.moc] Error 1
                  mingw32-make: *** [debug] Error 2
                  15:50:36: Der Prozess "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" wurde mit dem Rückgabewert 2 beendet.
                  Fehler beim Erstellen/Deployment des Projekts TestUnit (Kit: Desktop Qt 5.8.0 MinGW 32bit)
                  Bei der Ausführung von Schritt "Make"
                  15:50:36: Verstrichene Zeit: 00:02.
                  

                  .pro

                  #-------------------------------------------------
                  #
                  # Project created by QtCreator 2017-04-30T15:50:30
                  #
                  #-------------------------------------------------
                  
                  QT       += testlib
                  
                  QT       -= gui
                  
                  TARGET = tst_testunittest
                  CONFIG   += console
                  CONFIG   -= app_bundle
                  
                  TEMPLATE = app
                  
                  # The following define makes your compiler emit warnings if you use
                  # any feature of Qt which as been marked as deprecated (the exact warnings
                  # depend on your compiler). Please consult the documentation of the
                  # deprecated API in order to know how to port your code away from it.
                  DEFINES += QT_DEPRECATED_WARNINGS
                  
                  # You can also make your code fail to compile if you use deprecated APIs.
                  # In order to do so, uncomment the following line.
                  # You can also select to disable deprecated APIs only up to a certain version of Qt.
                  #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                  
                  
                  SOURCES += tst_testunittest.cpp
                  DEFINES += SRCDIR=\\\"$$PWD/\\\"
                  

                  tst_...cpp

                  #include <QString>
                  #include <QtTest>
                  
                  class TestUnitTest : public QObject
                  {
                      Q_OBJECT
                  
                  public:
                      TestUnitTest();
                  
                  private Q_SLOTS:
                      void testCase1();
                  };
                  
                  TestUnitTest::TestUnitTest()
                  {
                  }
                  
                  void TestUnitTest::testCase1()
                  {
                      QVERIFY2(true, "Failure");
                  }
                  
                  QTEST_APPLESS_MAIN(TestUnitTest)
                  
                  #include "tst_testunittest.moc"
                  
                  K Offline
                  K Offline
                  koahnig
                  wrote on last edited by koahnig
                  #10

                  @Try2Beatus said in Qt-Unit-Test lässt sich nicht auführen:

                  moc: Too many input files specified: 'Wilcke/Documents/TestUnit/"' 'tst_testunittest.cpp'

                  Da wird der Fehler angegeben. Es werden zwei Eingabedateien "gesehen" und nur eine ist erlaubt.

                  Das Problem rührt von deinem Usernamen bzw dem Blank zwischen Vor- und Nachnamen unter Windows her. Theoretisch kann man das Alles mit Doppelanführungsstrichen klammern. Dies wird auch in der Kommandozeile gemacht. Allerdings auf zwei verschiedene Arten und eine ist falsch. Siehe zum Beispiel -DSRCDIR= und weiter hinten, sieht es etwas anders aus. Auf Anhieb weiss ich nicht was nun richtig ist, aber du kannst es eh nicht ändern, da alles vorgegeben wird. Es ist wohl ein Bug und sollte unter JIRA rapportiert werden.

                  Als Lösung für dein Problem würde dir vorschlagen und ein lokales Folder direkt auf der untersten Ebene anlegen. Z.B. c:/Source und dort arbeiten. Ich mache das schon immer so auch um diese Probleme zu vermeiden. Windows steht mit dem Erlauben von Leerzeichen im Folder und Filenamen etwas alleine da und da kommen immer mal wieder Probleme auf. Beliebt sind auch die Probleme mit den Programmpfaden.

                  Alternative müsstest du dir eine neuen Namen als User bei Windows zu legen. Allerdings rate ich davon ab. Erfahrungsgemäss ist das ein Fass ohne Boden.

                  Vote the answer(s) that helped you to solve your issue(s)

                  Try2BeatusT 1 Reply Last reply
                  1
                  • K koahnig

                    @Try2Beatus said in Qt-Unit-Test lässt sich nicht auführen:

                    moc: Too many input files specified: 'Wilcke/Documents/TestUnit/"' 'tst_testunittest.cpp'

                    Da wird der Fehler angegeben. Es werden zwei Eingabedateien "gesehen" und nur eine ist erlaubt.

                    Das Problem rührt von deinem Usernamen bzw dem Blank zwischen Vor- und Nachnamen unter Windows her. Theoretisch kann man das Alles mit Doppelanführungsstrichen klammern. Dies wird auch in der Kommandozeile gemacht. Allerdings auf zwei verschiedene Arten und eine ist falsch. Siehe zum Beispiel -DSRCDIR= und weiter hinten, sieht es etwas anders aus. Auf Anhieb weiss ich nicht was nun richtig ist, aber du kannst es eh nicht ändern, da alles vorgegeben wird. Es ist wohl ein Bug und sollte unter JIRA rapportiert werden.

                    Als Lösung für dein Problem würde dir vorschlagen und ein lokales Folder direkt auf der untersten Ebene anlegen. Z.B. c:/Source und dort arbeiten. Ich mache das schon immer so auch um diese Probleme zu vermeiden. Windows steht mit dem Erlauben von Leerzeichen im Folder und Filenamen etwas alleine da und da kommen immer mal wieder Probleme auf. Beliebt sind auch die Probleme mit den Programmpfaden.

                    Alternative müsstest du dir eine neuen Namen als User bei Windows zu legen. Allerdings rate ich davon ab. Erfahrungsgemäss ist das ein Fass ohne Boden.

                    Try2BeatusT Offline
                    Try2BeatusT Offline
                    Try2Beatus
                    wrote on last edited by Try2Beatus
                    #11

                    @koahnig

                    Vielen Dank!

                    Jetzt klappt alles und ich kann endlich weiter Arbeiten.

                    Ich habe jetzt wie du sagtest, direkt unter "C:" einen Developing Ordner angelegt und es hat direkt ohne Probleme funktioniert.

                    Das Problem ist somit gelöst :D

                    K 1 Reply Last reply
                    1
                    • Try2BeatusT Try2Beatus

                      @koahnig

                      Vielen Dank!

                      Jetzt klappt alles und ich kann endlich weiter Arbeiten.

                      Ich habe jetzt wie du sagtest, direkt unter "C:" einen Developing Ordner angelegt und es hat direkt ohne Probleme funktioniert.

                      Das Problem ist somit gelöst :D

                      K Offline
                      K Offline
                      koahnig
                      wrote on last edited by
                      #12

                      @Try2Beatus

                      Gut zu wissen, dass es geklappt hat.

                      Markiere bitte noch den Thread als gelöst. Rechte Combobox "Topic Tools" unter dem Post und "Mark as Solved".

                      Weiterhin Viel Glück mit deinem Projekt

                      Vote the answer(s) that helped you to solve your issue(s)

                      1 Reply Last reply
                      0

                      • Login

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