Power_tile
Power_tile

Reputation: 830

Add All Folders Named "inc/" to Additional Include Path in Visual Studio 2022

I am working with a C project in Visual Studio 2022 Visual C++. There are multiple libraries included in the source code and all of them contain an inc/ directory for header files. I am trying to add all of them to the "Project Property > Configuration Properties > C/C++ > General > Additional Include Directories". I am now using the wildcard $(ProjectDir)**\inc but VS still cannot find the header files. I have checked that this macro correctly expands to C:\Path\To\My\Project\**\inc.

What should I put instead?

Upvotes: 1

Views: 903

Answers (1)

Minxin Yu - MSFT
Minxin Yu - MSFT

Reputation: 4247

Visual Studio C++ project does not support wildcards.

https://developercommunity.visualstudio.com/t/project-item-capture-by-wildcard-is-broken/1030344

You could use a simple script and copy the result to Project Property > Configuration Properties > C/C++ > General > Additional Include Directories

PowerShell:

$result = Get-ChildItem -Path "C:\Path\To\My\Project\**\inc" -Directory | ForEach-Object { $_.FullName }
$resultString = $result -join ";"
Write-Host $resultString

Upvotes: 1

Related Questions