Solved Visual Studio Qt Plugin: C++/MOC Item Type change
-
I converted a .PRO to a .VCXPROJ and experience a weird behavior. One (just one!) of the QT .CPP files always "changes on its own" to be compiled by MOC instead of using C/C++ compiler. This file is part of a .UI/.H/.CPP bundle. Then I always get weird file access denied errors..
The .VCXPROJ/.SLN is always kept open, but sometimes I open QT Designer.
Who is changing this in background and how can I supress this automatic change?
Edit: I re-imported the .PRO file from scratch again, and the suspicious file is set to MOC compilation by default!! What is in this file, that the imported thinks, it is a MOC instead of a simple CPP file?
-
Unbelieveable !! Got it !!
Somewhere in the code in a '#if false / #endif' block there is a Q_OBJECT which gets recognized totally wrong ! -
Hi,
You might want to share the content of that file otherwise it's pretty much crystal ball debugging.
The .pro file content may also help understand what is going on.
-
@SGaist said in Visual Studio Qt Plugin: C++/MOC Item Type change:
Hi,
You might want to share the content of that file otherwise it's pretty much crystal ball debugging.
The .pro file content may also help understand what is going on.Both are pretty large, but nothing special. The UI of the suspicious file is a simple QDialog as many others I am using - in the same project. I wonder why "somebody" is changing the "Item Type C/C++ compiler" of an entry in the VCXPROJ at all?
Edit: It changes, when I open the CPP file and save it to disk! How can I supress this change??
-
Unbelieveable !! Got it !!
Somewhere in the code in a '#if false / #endif' block there is a Q_OBJECT which gets recognized totally wrong ! -
Funny, the next thing I had in mind was about Q_OBJECT :)
Glad you found out and thanks for sharing !
-
@SGaist said in Visual Studio Qt Plugin: C++/MOC Item Type change:
Funny, the next thing I had in mind was about Q_OBJECT :)
I hate it, if 'programmers' automatically change something without any notification, which I manually set correctly!
-
Can you share that ifdef snippet ?
I remember issues in the old time with that kind of construct.
Which version of Qt are you using ?
-
@SGaist
I reported this bug in: https://bugreports.qt.io/browse/QTVSADDINBUG-855