Include whole folder of source files In Visual Studio
Many of our embedded c++ projects are compiled for and debugged on the target platform and win32 (simulation). This requires us to use two different IDEs, in this case Visual Studio and a vendor customized eclipse.
The eclipse based IDE uses a black list approach to source files, meaning that all files will be compiled, unless they are excluded.
We would also like this behavior in VS, because else developers has to manually add them in VS as an extra step, when they are using the other IDE.
We have found one almost working solution:
we edit the .vcxproj files to use wildcards in the "ClInclude" entries:
<ClInclude Include="include\**\*.h" />
<ClInclude Include="include\**\*.hpp" />
<ClInclude Include="src\**\*.hpp" />
<ClInclude Include="src\**\*.h" />
<ClCompile Include="src\**\*.c" />
<ClCompile Include="src\**\*.cpp" />
When the project is loaded, it includes all our source files (success!)
But now adding files from from within VS (Add->New item) results in an error "An internal error occurred. Please contact Microsoft Product Support Services.
Adding files outside VS also requires a complete reload of the solution.
Excluding files is also not easy.
We need Visual studio IDE to fully support the wild card feature.
VS 2017 adds all files explicitly and removes the wildcard which is better than error but still annoying.
Seven Dreams commented
Really like your last sentence "fully support the wild card feature." This is actually already supported, you know? See here:
You can use ** for recursive folders and * for any file in a directory plus their extension. MSVC does not auto-update the sources files in the view tho.