Reputation: 3275
I am creating a C++ Visual Studio project.
I created a filter for all the headers and one for sources files. My files are in a folder with many sub folders.
Is there a way to add recursively all files *.h in my header folder and all the *.cpp in the source folder ?
My project :
Upvotes: 1
Views: 2187
Reputation: 8018
The simplest solution for your problem seems to select each of the file entries in the Project-Explorer view, and drag and drop them to the filter folder you want them appearing.
Regarding to add new items you can select multiple files from the open file dialog, but you need to address each subdirectory separately.
Another option I could think of is to edit the .vxcproj.filters
file directly in an appropriate text editor, or with a (XML) text processing tool.
If I open my projects .vxcproj.filters
file in Notepad++ the relevant snippets look like this:
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Registry.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CommandId.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CommandBase.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Command1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Command2.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CRTPSelfRegister.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
Upvotes: 2