"QtRunWork" task returned false but did not log an error. (Unknown compiler flavor)

Viewed 4457

Im working on a Qt project. Everything has been working perfectly untill I opened application this morning. I got error: "QtRunWork" task returned false but did not log an error. Im using VS2019 with QtExtension.

This is output:

1>Moc'ing ..\src\mainwindow.h...
1>Moc'ing ..\src\settingsdialog.h...
1> moc: Unknown compiler flavor 'msvc;msvc'; valid values are: msvc, unix.
1> Usage: C:/Qt/5.15.1/msvc2019_64/bin/moc [options] [header-file] [@option-file] [MOC generated json file]
1> Qt Meta Object Compiler version 67 (Qt 5.15.1)
1> Options:
1>   -?, -h, --help                    Displays help on commandline options.
1>   --help-all                        Displays help including Qt specific
1>                                     options.
1>   -v, --version                     Displays version information.
1>   -o <file>                         Write output to file rather than stdout.
1>   -I <dir>                          Add dir to the include path for header
1>                                     files.
1>   -F <framework>                    Add Mac framework to the include path for
1>                                     header files.
1>   -E                                Preprocess only; do not generate meta
1>                                     object code.
1>   -D <macro[=def]>                  Define macro, with optional definition.
1>   -U <macro>                        Undefine macro.
1>   -M <key=value>                    Add key/value pair to plugin meta data
1>   --compiler-flavor <flavor>        Set the compiler flavor: either "msvc" or
1>                                     "unix".
1>   -i                                Do not generate an #include statement.
1>   -p <path>                         Path prefix for included file.
1>   -f <file>                         Force #include <file> (overwrite default).
1>   -b <file>                         Prepend #include <file> (preserve default
1>                                     include).
1>   --include <file>                  Parse <file> as an #include before the main
1>                                     source(s).
1>   -n <which>                        Do not display notes (-nn) or warnings
1>                                     (-nw). Compatibility option.
1>   --no-notes                        Do not display notes.
1>   --no-warnings                     Do not display warnings (implies
1>                                     --no-notes).
1>   --ignore-option-clashes           Ignore all options that conflict with
1>                                     compilers, like -pthread conflicting with
1>                                     moc's -p option.
1>   --output-json                     In addition to generating C++ code, create
1>                                     a machine-readable JSON file in a file that
1>                                     matches the output file and an extra .json
1>                                     extension.
1>   --collect-json                    Instead of processing C++ code, collect
1>                                     previously generated JSON output into a
1>                                     single file.
1>   --output-dep-file                 Output a Make-style dep file for build
1>                                     system consumption.
1>   --dep-file-path <file>            Path where to write the dep file.
1>   --dep-file-rule-name <rule name>  The rule name (first line) of the dep file.
1> Arguments:
1>   [header-file]                     Header file to read from, otherwise stdin.
1>   [@option-file]                    Read additional options from option-file.
1>   [MOC generated json file]         MOC generated json output
1>Moc'ing ..\src\deviceManager.h...
1>Moc'ing ..\src\treemodel.h...
1>C:\Users\user\AppData\Local\QtMsBuild\qt_globals.targets(268,5): error MSB4181: The "QtRunWork" task returned false but did not log an error.
1>Done building project "project.vcxproj" -- FAILED.

I've tried changing compiler flavor but have not managed to do it. I tried changing it in Qt Project Settings, but it did not do anything. Thank you for your time.

Edit: Out of about 20 .h I've tracked the one that gives this error when trying to compile in VS2019 using Qt Extension. Have no idea how to fix this error.

3 Answers

I had the same issue.

Accidentally I had a normal int declared under my public slots:. Moving it into normal public: worked for me and resolved the issue.

Hopefully this will work for you as well.

I uninstalled the Qt VS tool from Visual Studio and install the previous version of Qt VS tool.

You can find it here: https://download.qt.io/official_releases/vsaddin/2.5.2/

That works for me. Maybe a problem with the new version.

Edit: Don't forget to disable auto-update.

Helped to overload the Q_OBJECT macro It was

class CXXX: public CTTT
{
  Q_OBJECT

Has become

class CXXX: public CTTT
{
  //Q_OBJECT
Related