0

I often find that I have problems getting visual studio to find my headers and I think I might have finally found out why: it seems that visual studio does not understand multiple relative directories in project configurations, e.g:

enter image description here

When that directory certainly does exist.

My question is: can somebody confirm this is the case and, if so, is there a reason why they'd do this? Is it a bug or intentional?

Community
  • 1
  • 1
Luther
  • 1,786
  • 3
  • 21
  • 38
  • Does `$(ProjectDir)` finish with a `\`? – AdrianHHH Jan 12 '15 at 15:21
  • Nope, the contents are: c:\prog\engine\vs2010project – Luther Jan 12 '15 at 15:27
  • So your directory specification is `c:\prog\engine\vs2010project..\..\angle\include`. I think you simply have a missing backslash. (My earlier comment was intended to ask if there is a trailing backslash, the backslash character got lost, apologies.) – AdrianHHH Jan 12 '15 at 15:30
  • Oops, no sorry. It does have the trailing backslash. c:\prog\engine\vs2010project\..\..\angle\include – Luther Jan 12 '15 at 15:31
  • Ok, scrub this question. The problem was that the project properties pages configuration drop down didn't match the currently active one. It had been reset somehow, which threw me. I'll delete the question. – Luther Jan 12 '15 at 15:53

1 Answers1

1

Posting as an answer as I can't really fit this into a comment although its a bit frowned upon...

The easiest way to debug this is to run Process Monitor from here, and add a filter to only show access to your file name. I made an example c++ project which tried to load a non existant header #include "Bobby.h" and then added the following filter to Process Monitor:

Path Contains Bobby.h Include

Then I ran the build and got the following output:

CreateFile  C:\Users\MyUserName\Documents\Visual Studio 2012\Projects\ConsoleApplication2\ConsoleApplication2\Bobby.h   NAME NOT FOUND
CreateFile  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\Bobby.h  NAME NOT FOUND
CreateFile  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include\Bobby.h   NAME NOT FOUND
CreateFile  C:\Program Files (x86)\Windows Kits\8.0\Include\um\Bobby.h  NAME NOT FOUND
CreateFile  C:\Program Files (x86)\Windows Kits\8.0\Include\shared\Bobby.h  NAME NOT FOUND
CreateFile  C:\Program Files (x86)\Windows Kits\8.0\Include\WinRT\Bobby.h   NAME NOT FOUND

From this output you can easily see where the compiler searched for the header file - It may be good enough to help you understand why it didn't find it.

HTH

Mike Vine
  • 9,468
  • 25
  • 44
  • Thanks Mike, that is a help. Turns out I was just editing the wrong configuration. I think the currently selected project got changed during a git merge, which threw me. Ah well. – Luther Jan 12 '15 at 15:55