I am using QtPropertyBrowser in my example based project ObjectController. I am using Visual Studio 2010 as an IDE and version 5.2.1 of Qt (I could reproduce the error for Qt 4.7 and 4.8).
All files moc_*.cppare added to the source tree GeneratedFiles\$(Configuration). Unfortunately, this leads to the following compiler error:
2> moc_objectcontroller.cpp
2> GeneratedFiles\Release\moc_objectcontroller.cpp(70): error C2027: use of undefined type 'ObjectControllerPrivate'
2> c:\***\guimain\generatedfiles\release\../../src/objectcontroller.h(45) : see declaration of 'ObjectControllerPrivate'
2> GeneratedFiles\Release\moc_objectcontroller.cpp(70): error C2227: left of '->slotValueChanged' must point to class/struct/union/generic type
When I delete moc_objectcontroller.cppfrom the source tree (without actually deleting the file on disk), the project builds and works fine. All other files moc_*.cppmust be in the source tree, otherwise the project will not be linked.
Does anyone know why the compiler generates an error? Is there a solution / workaround that you know of?
Edit: on request, the appropriate code files: