Sometimes I need to perform a rebuild of my project but I don't want the pre-compiled headers to be recompiled every time I do that - sort of defeats the purpose, at least in this case. Is there any way to get Visual Studio to rebuild without recompiling the PCH and compile the PCH as needed (if the rarely changed headers change)
Asked
Active
Viewed 754 times
1
-
Why are you doing a rebuild then? Not rebuilding the PCH completely defeats the point of rebuilding. – Billy ONeal Sep 18 '10 at 03:43
-
Well, I have run into a situation quite a few times where I need to rebuild my source but the PCH were not touched, so why rebuild them and waste time? Currently, when I require a rebuild without a rebuild of the PCH as well I delete everything in the `$(IntDir)` except for the `.pch` file. I was hoping for a quicker solution within the IDE. – Samaursa Sep 18 '10 at 04:23
-
Perhaps you should explain why the normal 'Build' option is not working for you. – Bart van Ingen Schenau Sep 18 '10 at 20:14
-
Many times Visual Studio has trouble building the project again without a rebuild. I found this usually happens with heavy modifications to the source, usually the headers. Sometimes I encounter an error where it fails to build and complains about locked .pdb files. I have to clean/build or rebuild after that. I assumed this was a very common issue with incremental builds enabled (and why Visual Studio has 'rebuild' and 'clean' solution)? – Samaursa Sep 19 '10 at 01:57
1 Answers
2
Write a script for it and add it to the tools menu using 'Tools->External Tools...', giving you a solution 'Within the IDE'. Your delete-exe-files script can include the build step as per:
How do I compile a Visual Studio project from the command-line?

Community
- 1
- 1

James Crook
- 1,600
- 12
- 17