Too many input files specified in moc
-
I have a problem with Qt. I'm using Qt for VS2022. When I added the header paths via the Directory.Build.props file, there's a problem with the moc.
Qt: 6.9.1 1>moc AquariumPlugin.h 1> moc: Too many input files specified: 'D:\Users\Marcin\Project2\Plugin.h' 'D:\Users\Marcin\Project2\' 1> Usage: C:/Qt/6.9.1/msvc2022_64/bin/moc [options] [header-file] [@option-file] [MOC generated json file] 1> Qt Meta Object Compiler version 69 (Qt 6.9.1) 1> Options: 1> -?, -h, --help Displays help on commandline options. 1> --help-all Displays help, including generic Qt 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> --debug-includes Display debug messages of each considered 1> include path. 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> --require-complete-types Require complete types for better 1> performance 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
This is my props file. What should I do?
<?xml version="1.0" encoding="utf-8"?> <Project> <ItemDefinitionGroup> <ClCompile> <AdditionalIncludeDirectories> `$(ProjectDir);` "D:\Users\Marcin\C++\QC\include"; "C:\vcpkg\installed\x64-windows\include\opencv4"; "C:\vcpkg\installed\x64-windows\include\opencv4\opencv2"; %(AdditionalIncludeDirectories) `</AdditionalIncludeDirectories>` </ClCompile> </ItemDefinitionGroup> </Project>
-
@SirMarcin Hi
You can right-click on “AquariumPlugin.h” and click on the properties menu on VS2022.
See the moc.exe settings is right or not. -
My problem is deeper and primarily concerns the lack of access to header files from the props file. You won't believe it, but I know what's going on, although it's a bit of a bummer. If I set my header file to a moc file, Qt suddenly doesn't see any include files. This happens with everything. moc files are treated as C/C++ headers and unfortunately don't have inherited paths from the props file. Any ideas on how to add these paths in the props file for moc as well? Currently, if I specify "local" at the very top of the paths window, it works – the moc file compiler sees these paths. But it doesn't want to respect the header file folders inherited from the moc file. How do I add an equivalent for QtMoc in the props file? I want the compiler to see the additional directories.
-
@SirMarcin I'm not sure how to deal with your situation :(
but the <AdditionalIncludeDirectories> node in the props file is passed to the compiler to specify the directories to include header files, not to compile those directory files.