[Qt-interest] Precompiled headers in Visual Studio
Alan M. Carroll
amc at network-geographics.com
Mon Dec 14 19:55:24 CET 2009
I will illustrate them using the presumed project file "header.hpp" from which is generated "moc_header.cpp". The question is how to get moc_header.cpp to include Precompiled.hpp.
Make sure the Properties Windows is showing (use Alt-Enter if not). Select the project in the solution explorer. In the property window you should see an entry labeled "MocOptions". You want to add to the front
-fPrecompiled.hpp -f"../../$(InputFileName)"
The ordering is important. The second -f is what makes moc_header.cpp include header.hpp which is required. I got burned because if no -f is specified it automatically includes the source header, but if you use -f to specify Precompiled.hpp you also lose that automatic inclusion. So you have to do both.
What makes this painful is that you have to update this for every header already in the project. You can hand edit the custom build step, or you can just remove the header and then add it back.
At 03:03 PM 12/13/2009, Donovan Parks wrote:
>How can I modifying the
>"moc'ing" of my project so it includes Precompiled.hpp instead of
>StdAfx.h?
More information about the Qt-interest-old
mailing list