Reputation: 8511
I am wondering how would I reference a file from another project in C++.
For example, I have moved avocado.h
from my Vegetable project to Fruit project. In fruit.cpp, I am trying to include avocado.h
, but the compiler cannot find avocado.h
.
Original recipie.cpp:
#include "avocado.h" //error c1083: Cannot open included file: 'avocado.h':No such file or directory
My existing solution is to use namespaces, but I am wondering if it will be much more efficient for me to somehow tell #include
exactly where to look?
Current recipie.cpp:
namespace fruit {
class avocado;
}
EDIT - Sorry, I should mention that I am working in a Solution (or library) where both Fruit and Vegetable projects are under the same solution.
Upvotes: 1
Views: 91
Reputation: 693
Since you've moved the header from one project to another, you should probably move it physically, as well, in same directory as recipie.cpp
. Alternatively, you can change the Fruit
project properties: Configuration Properties \ VC++ Directories \ Include Directories
to include the path to avocado.h
Upvotes: 2