VS2022 Qt Addin moc problem
-
Hello,
we are currently determining which build system is most suitable for us to move away from qbs. One of them is Visual Studio with the Qt addin.
The current problem is that the moc has to run on cpp's too.However, I get the error message that the file does not exist. Is there a way to achieve this using the Qt addin or does it have to be done via an additional project step?
-
Hello,
we are currently determining which build system is most suitable for us to move away from qbs. One of them is Visual Studio with the Qt addin.
The current problem is that the moc has to run on cpp's too.However, I get the error message that the file does not exist. Is there a way to achieve this using the Qt addin or does it have to be done via an additional project step?
@scho Select the .cpp file in solution explorer and go to its properties. In the General section change the Item Type from
C/C++ compiler
toQt Meta-Object Compiler (moc)
. -
Hello @Chris-Kawa ,
sorry for the late reply.
Thanks, that helped!
Now I have the problem that the project can't find the Qt classes from core.The error message is that QtRunWork returned false. After searching, it was recommended to install an older version of Qt Tools. Is it recommended to try the versions for Visual Studio 2022?
Thanks for the help!
-
Hello @Chris-Kawa ,
sorry for the late reply.
Thanks, that helped!
Now I have the problem that the project can't find the Qt classes from core.The error message is that QtRunWork returned false. After searching, it was recommended to install an older version of Qt Tools. Is it recommended to try the versions for Visual Studio 2022?
Thanks for the help!
@scho said:
Now I have the problem that the project can't find the Qt classes from core.
Do you have the core module selected in the project settings? Do you have the includes for those classes?
it was recommended to install an older version of Qt Tools
I mean you can try, but I doubt it will change anything. I have no problem running apps on the latest version of the extension. I would rather guess that your app is missing some runtime dependency (a needed dll can't be found) and it just doesn't start because of that.
Is it recommended to try the versions for Visual Studio 2022?
You need the version for the VS version you're using, so if you're using VS2022 use the extension for VS2022. If you're using older version of VS then use the extension for that. AFAIK Visual Studio won't let you install an extension for different version.
-
Hello @Chris-Kawa,
we tried many things and found a solution for our problem.
The main problem was the given Includes are ignored.We set "Override C/C++ Properties" to "Extend" and append all include paths in "Additional Inlucde Directories".
Is that a bug?
We got another little problem with the C/C++ Preprocessor Defines. We cant set them because in the project was only one cpp file in our project and this is set to moc.
We had to add a dummy.cpp file so you can get the C/C++ tree tab.
Thanks for your help.
-