69

I was looking through the folder for an application I am working on and noticed the "ipch" folder, for my solution which has two small projects it weighs in at about 90mb+ in size.

I have found an article discussing the use for the files and was wondering if they were safe to delete? I would like to keep the applications footprint as small as possible. If I were to delete the folder will the application remain in a safe and stable state?

Pre-Compiled Headers

0

4 Answers 4

102

Managed to find a pretty informative answer from the MSDN support forums:

I'm not only a C# moderator but also a C++ user :} The ipch directory and the many, many new files generated by the compiler can be safely deleted. In fact they should be deleted (and probably are) for clean builds. I teach a C++ college class myself and here is what I require my students to do.

1.In the solution folder delete all bin, obj, ipch, debug and release directories.

2.Delete any .suo files

3.Delete any .user files

4.Delete any .ncb files

5.Delete any .sbr files

6.Delete any .*log files (for VS 2010)

I've had no issues following the given steps.

(Source and original post)

Update:

raphinesse has also linked to a question which states that the .SDF file can be removed safely as well.

4
  • 5
    .suo and .user files contains state like what files are open, breakpoints that have been set and bookmarks
    – sean e
    Commented Apr 27, 2013 at 5:27
  • I made a bat file (Not well written, can't handle batch :/) that clean a project directory from the files mentioned as well as any XXX's conflicted copy that comes from Dropbox syncing. hastebin.com/jesayawuyu Commented Oct 14, 2013 at 9:12
  • 2
    This .gitignore set is useful to check which files are not actually needed in different environments such as Visual Studio. It will often correspond to the files you do not need to keep track on when using source control. Commented Jan 17, 2014 at 11:05
  • 1
    " In fact they should be deleted (and probably are) for clean builds" - I think it's wrong. Commented Oct 19, 2022 at 9:00
17

I was bothered by my 'ipch' folder and deleted it. When you open the project again the 'ipch' folder is recreated. Runs just like before.

1
  • 1
    No wonder you were bothered. For a CMake project with a code base of less than 4KB Visual Studio generates more than 120MB in PCH folders and cryptic files. I thought that Android Studio does and overkill for even the simplest hello world type of project for an app. Visual Studio is a clear winner here... Commented Aug 11, 2021 at 14:34
5

Yes, it is safe - all that is in this gitignore file is safe to remove: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

4

There are a number of files that Visual C++ uses temporarily that can freely be deleted. Most of them will automatically be recreated the next time you load the project, while the others will be regenerated the next time you build your project.

I have found the need to prune these files out for zipping and sharing online, so I wrote this utility for pruning the temporary files.

In direct answer to the question, the answer is yes.

Not the answer you're looking for? Browse other questions tagged or ask your own question.