“QtRunWork”任务返回 false,但未记录错误。(未知的编译器风格)

And*_*raz 5 c++ qt visual-studio

我正在做一个 Qt 项目。一切都很顺利,直到我今天早上打开申请。我收到错误:“QtRunWork”任务返回 false 但未记录错误。我使用 VS2019 和 QtExtension。

这是输出:

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.
Run Code Online (Sandbox Code Playgroud)

我尝试过更改编译器风格,但未能成功。我尝试在 Qt 项目设置中更改它,但它没有执行任何操作。感谢您的时间。

编辑:在大约 20 个 .h 中,我跟踪了尝试使用 Qt 扩展在 VS2019 中进行编译时给出此错误的那个。不知道如何修复此错误。

小智 7

我遇到过同样的问题。

意外地,我在int我的public slots:. 将其恢复正常public:对我有用并解决了问题。

希望这也对您有用。

  • 干杯,公共插槽声明中缺少分号。位于输出窗口中,不在错误列表中。 (2认同)

小智 4

我从 Visual Studio 中卸载了 Qt VS 工具并安装了早期版本的 Qt VS 工具。

您可以在这里找到它:https ://download.qt.io/official_releases/vsaddin/2.5.2/

这对我行得通。可能是新版本的问题。

编辑:不要忘记禁用自动更新。