Recently I have installed VS Addin from Qt Software and I imported my .pro project to VS2008. Generally, all works fine, with one small but annoying exception.
Suppo
Recreating the .vsproj
file using qmake might fix the problem.
For every QObject file you have, the QT plugin creates a moc_ file for every build configuration (usually just Debug and Release). When you change the current configuration you can see the No entry signs go from one file to the other.
The moc_ files shouldn't change when you change the .cpp file. only when you change the .h files.. All this leads me to thing that something wrong happened with your configuration and really the best way to fix it is to recreate it with qmake using something like this:
qmake -spec win32-msvc2008
Yes, I use the latest VS Addin and my project is correctly seen as a Qt Project.
I have seen the excluded from build behavior in VS2008 (VS 2003 too), but the project builds correctly. When you change a moc'able file, Qt will have to recreate the moc'ed file because it is out of date.
I suspect that Qt's algorithm is something like:
Looking at my VS 2003 project, I can see that some moc_* files are included twice in the project, one version is set as excluded from build and the other is not.
Actually, I've found the solution for that "feature". You have to add BOTH files from GeneratedFiles\Debug and GeneratedFiles\Debug (or from other configurations directories). Qt will exclude from build everything what does not belong to the currently selected build type.
did you set your configuration correctly?
Open the window "Debug Configuration Settings" Set the following items as stated below:
Repeat the same with the release configuration
Problem solved. I found out that in my hand-crafted .pro file describing my project, I had MOC_DIR specified as:
MOC_DIR = .moc
After importing to Visual Studio directory for "Generated files" was the same for both Release and Debug. So, when my active configuration was Debug for example, when I saved a file it became excluded from build because it was sensible for Release-related file - just as rpg and Andrew suggested. After changing the directory to .moc\$(ConfigurationName) the problem is no longer seen (and I see 2 versions of each generated file in my solution - one for each configuration).
Thank you for your help everyone!