Domanda

I am having two projects in one solution called SOL, using Visual Studio: project 1 and project 2

In each of projects: I am having some headers and cpp files.

In project 2, I want to use a header existing in project 1:

#include "proj1.h"

I am having an error which states that the file doesn't exist:

 Error  2   error C1083: Cannot open include file: 'proj1.h': No such file or directory C:\Users\...\Visual Studio 2010\Projects\SOL\proj2.cpp  28
È stato utile?

Soluzione

I'm using VS 2012 but AFAIK for this subject this is nearly the same.

  • Open the project properties page of project 2. Right-click on project 2 in the solution explorer and select "Properties".
  • In the C/C++ section select "General".
  • Find the line "Additional Include Directories" and add "$(SolutionDir)project 1". This is a semicolon separated list but you can as well choose to edit this field, then you get a list view.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top