3

I noticed that the default behavior for Visual Studio C++ projects is to organize files using filters instead of folders on disk. Essentially all the source files within the project are stored in the same disk directory, but the filters virtualize the files into a hierarchy.

What value do "filters" offer compared to the traditional "folders organized on disk"?

Edit: This question is related to "software engineering" in the sense that it deals with the management of many files. For example, do filters make version control easier since all files are placed in a single directory?

1
  • 1
    Sharing your research helps everyone. Tell us what you've tried and why it didn't meet your needs. This demonstrates that you've taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How to Ask
    – gnat
    Jul 9, 2021 at 4:54

1 Answer 1

6
+50

The primary benefit of filters in my experience is to separate headers (.h) files from source (.cpp) files. Then it's easier to traverse your c++ classes by using headers (you can use the refactoring wizard to add function definitions when declaring new functions, and you can more easily go to function definitions from the headers, as sometimes the source files (.cpp) can be very large). I usually use sub-directories for including c++ namespaces, and external class libraries (ie. local include directory) but filters will only apply to my c++ classes. There are also filters for resources, web-files and SQL-files so it's a nice way of separating different types of content which may not be involved in compilation and linking but still involved in the project build cycle

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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