BlueSpud
BlueSpud

Reputation: 1623

Recursive Include Paths in Visual Studio 2015


So I'm new to using Visual Studio and I'm trying to create a project to compile my existing program. The program already is compiling on macOS using Xcode. The folder structure of the project looks like this:

main folder
  src
    some code here
    Debug
      some code here
    Utility
      some code here
      Special Utility Folder
    Rendering
      some code here
      Rendering Utils
...

When I tried to load the project up into Visual Studio, I got a lot of errors saying that the header files could not be found. I did some investigation and it seems like the include paths are not recursive. So to include a file from src/Utility I would have to write

#include "Utility/header.hpp"

But all of the code in the project uses includes like

#include "header.hpp"

Is there a way to get this to work in visual studio?

P.s. manually adding all of the folders as their own include paths works, but it will be a pain to maintain as the project grows, especially since majority of my work will be done in Xcode

Upvotes: 0

Views: 3993

Answers (1)

Rama
Rama

Reputation: 3305

You can set the include paths for all the folders(it is not recursive) in the project properties:

To access the project configuration:

  1. Right-click on the project, and select Properties.
  2. Select Configuration Properties->C/C++->General.
  3. Set the path under Additional Include Directories: i.e.: . Debug Utility etc..

Maybe you can also use a cmd tool to create the includes path in a txt file(i.e.: IncludePath.txt). Inside that file you can add the include folders:

/I "."
/I ".."
/I ".\Debug"
/I ".\Utility"

Then set the path under Additional Include Directories:

@IncludePath.txt

Upvotes: 1

Related Questions