infect
infect

Reputation: 55

c++ include from another solution

i have two VS2013 solutions A and B. My Solution B, containing multiple Projects, was originally compiled to be an executable, but i want to use its functions in solution A, so i changed its compilation to a .lib file.

I added the .lib file from B to my Solution A, but i still have to include the headers. When i try to include them like this:

#include <SolutionB/ProjectB1/header1.h>

header1.h tries to include

#include "globals.h"

globals.h is obviously in the /SolutionB/ProjectB1/ path and can therefore not be found by Solution A. What is the most simple way to make SolutionA find all the correct headers? Since SolutionB is quite big i do not want to copy it into the SolutionA folder (which would also make the .lib file obsolete?), neither do i want to rewrite every #include directive in SolutionB. Is there any possibility to do that?

Thank you very much

Upvotes: 2

Views: 464

Answers (1)

Rakete1111
Rakete1111

Reputation: 48948

#include searches through a set of directories for the specified header. Solution B is not part of this list of directories, so #include can't find the headers.

In Visual Studio 2015 (should be applicable to all other versions):

  1. Go to Project -> ... Properties
  2. Go to Configuration Properties -> VC++ Directories
  3. Under Include Directories you can append the path to the files of Solution B ((some other path);your\path\to\solution\b)

Upvotes: 1

Related Questions