Reputation: 26333
I have a VS2013 solution with this structure:
There is a build dependency of gtestalgo project on algo project.
algo projects alone builds successfully. algo project includes Intel TBB: the Linker properties contain Additional Library Directory "$(tbb_path)\lib\intel64\$(tbb_subdir)
" and input "tbb.lib
".
gtestalgo project does not compile. Errors are all related to TBB. More precisely, errors refer to files in algo project where TBB is not recognized, ex "TBB is not a class or namespace name". gtestalgo project has got ../algo
as an Additional Include Directory, where ../algo
contains all source and header files for algo project. gtestalgo project links the library algo.lib, and Linker Additional Library Directory and Input are correctly set. Sources in gtestalgo project include several header files from algo project: #include "algo_main.h"
, etc...
I tried to Link TBB to gtestalgo project (with same Linker properties as in the algo project), and I also tried to remove this Link. In both cases, compilation errors are the same.
How come that algo project compiles, but gtestalgo project does not compile, complaining that TBB is not recognized in sources from algo project ?
Should I Link TBB library to gtestalgo project, when no code in gtestalgo project sources uses TBB (algo project only implements the TBB API) ?
Any idea what can go wrong here ?
Upvotes: 0
Views: 487
Reputation: 26333
You can include it directly with something like #include "../algo/stdafx.h" (in gtestalgo/stdafx.h if there is one).
This is enough to solve the issue. Some includes in the stdafx precompiled header in the algo project were not visible to the gtestalgo project.
Upvotes: 0
Reputation: 6537
Sources in gtestalgo project include several header files from algo project:
#include "algo_main.h"
, etc...
It suggests that if Algo header files include TBB, including such Algo headers into GTestAlgo project brings dependency upon TBB into it.
Since the Algo project compiles well, I conclude that it sets Include directories correctly so TBB headers can be found.
But I don't see in your description how Include directories are set in GTestAlgo project. Set them the same way with respect to TBB location and it will likely compile fine.
Upvotes: 1