5

I was trying to re-use an available source code for my own project, it can be found here:
https://github.com/TadasBaltrusaitis/OpenFace
I tried compiling project FeatureExtraction of the original code, everything was fine. Then I created a new empty project and added the following #include:

#include "LandmarkCoreIncludes.h"

#include <Face_utils.h>
#include <FaceAnalyser.h>
#include <GazeEstimation.h>  

These are exactly the same as in project FeatureExtraction in the provided source code. I've already changed the additional include directories in C/C++ general tab into:

$(SolutionDir)\lib\local\FaceAnalyser\include  
$(SolutionDir)\lib\local\LandmarkDetector\include  

However, it still gave me "cannot open source file error".
Update: If I put the absolute path of the header file directly to the code it is OK, however if I put the absolute path to the Additional Include Directories, the error remained.

pyroshawn
  • 61
  • 1
  • 4
  • 1
    Isnt that include should be in quotes for the local headers `#include "FaceAnalyser.h"` ? – danglingpointer May 24 '17 at 07:54
  • That's what I thought, too but somehow it works in the original code and also the header files are not in same directory as the project files. – pyroshawn May 24 '17 at 08:18

2 Answers2

2

Use #include "header.h" instead of the one with diamonds (< and >) which looks in another directory.

After that, check if the header files really are in these directories. If they are, you should check the $(SolutionDir) ( I don't use a '\' after the $(SolutionDir) but it may work out as well).

Try to locate and delete the .suo file and restart VS

danglingpointer
  • 4,708
  • 3
  • 24
  • 42
  • Hi, thanks for comment. The header files are indeed in the designated folder. I also tried removing the '\' after $(SolutionDir)$ but it still didn't work. The restarting method after deleting .suo also didn't work. The weird thing is that I copied same settings from the original project, which works just fine, but my new created project didn't. – pyroshawn May 24 '17 at 08:02
  • I suppose you already tried the "turn it off and on again"-method? Just restart the machine, maybe something is messing with PATH. To what does your $(SolutionDir) evaluate? You can check this inside VS – John.A.Myer May 24 '17 at 08:36
  • @pyroshawn: "copying settings from original project" - do you mean exactly that? Or do you mean "copying settings from original **solution**"? Because two projects can share a single solution, and thus a single `$(SolutionDir)`, but two solutions won't share their `$(SolutionDir)`. That's pretty much the point of `$(SolutionDir)`. – MSalters May 24 '17 at 09:57
  • I deleted the `.suo` file and restart `VS`, that works for me. Thank you. VS 2017 Community Version – Rick Nov 28 '18 at 03:37
1

Looks like I had same "bug" as mentioned in this post here:
Visual Studio does not honor include directories
After having changed the Additional Include Directories for all platforms instead, the code was compiled without any errors.

pyroshawn
  • 61
  • 1
  • 4