Paul Jurczak
Paul Jurczak

Reputation: 8165

Visual Studio Code path syntax

Documentation at https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference is a bit fragmented. Can I use both path and path/** for recursive search and path/* for non-recursive search in includePath property?

Upvotes: 0

Views: 1428

Answers (2)

hagai
hagai

Reputation: 15

For recursive search in includePath property, path/** should be used.

Form the linked documentation (emphasis mine)

includePath An include path is a folder that contains header files (such as #include "myHeaderFile.h") that are included in a source file. Specify a list of paths for the IntelliSense engine to use while searching for included header files. Searching on these paths is not recursive. Specify ** to indicate recursive search. For example, ${workspaceFolder}/** will search through all subdirectories while ${workspaceFolder} will not. If on Windows with Visual Studio installed, or if a compiler is specified in the compilerPath setting, it is not necessary to list the system include paths in this list.

Upvotes: 0

phuzi
phuzi

Reputation: 13060

Form the linked documentation (emphasis mine)

path A list of paths for the Tag Parser to search for headers included by your source files. If omitted, includePath will be used as the path. Searching on these paths is recursive by default. Specify * to indicate non-recursive search. For example: /usr/include will search through all subdirectories while /usr/include/* will not.

And from the entry on includePath, since it is used if path is omitted (again, emphasis mine)

includePath An include path is a folder that contains header files (such as #include "myHeaderFile.h") that are included in a source file. Specify a list of paths for the IntelliSense engine to use while searching for included header files. If a path ends with /** the IntelliSense engine will do a recursive search for header files starting from that directory. If on Windows with Visual Studio installed, or if a compiler is specified in the compilerPath setting, it is not necessary to list the system include paths in this list.

Yes, use either path or path/**

Upvotes: 1

Related Questions