1
votes

I have a large C++ project within a Visual Studio 2008 solution file, and everything is compiling and building correctly. So far so good.

However, it is unable to find any header files when I attempt to open them directly from the IDE's code viewer window, even though the folder locations of those header files are enumerated in the "Additional Include Paths" section of the Properties page.

For example, this C++ code fragment builds successfully:

#include "ctrl_word.h"
#include "SwitchOBJ.h"

CMyLocalOBJ::CMyLocalOBJ()
{
    CSwitchOBJ cSwitchObj;
    // ...
}

However, when I right-click over any one of the header files' names and choose the context menu option "Open Document", this error dialogue box pops up:

File "ctrl_word.h" not found in current source's directory or in build system paths.
    Current source path: 
    Build system path:
        C:\Program Files\Microsoft Visual Studio 9.0\VC\include;
        C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include;
        C:\Program Files\Microsoft SDKs\Windows\v6.0A\\Include;
        C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include

The aforementioned file ctrl_word.h is indeed not present in any of the above-mentioned folders, and yet the build system has no problem finding it by looking up the additional include directories.

The main reason I'm concerned about this is because a similar "unable to open file X" behaviour is being exhibited by a Lint tool which I've configured to run within the IDE.

Any ideas on what could be the matter?

1
The double backslash in "C:\Program Files\Microsoft SDKs\Windows\v6.0A\\Include;" - typo or same in the configuration?slashmais
I think its not a typo. It could be that one had entered %PROJECTDIR%\include. This may resolve into C:\PROJECT_FOLDER\\include. But I think VStudio ignores the extra '\'.Ganesh R.
That's what I assumed. Does the other tools also ignore it (use the same shared function to access the folders)? You have the compiler on one hand which you know ignores it, and the IDE on the other which may not. When you do a manual search for the header, do you find it in this folder?slashmais
slashmais - I double-checked and the double backslash isn't a typo, it's what appears in the text on the aforementioned dialogue box. I'm not sure whether it refers to a configuration defect within Visual Studio.Anonymous
you can refer this stackoverflow.com/questions/12490015/…, looks like vs bugTony

1 Answers

1
votes

It may be that the IDE is not looking in the additional lookup directories or your intellisense file is corrupt. Try including the path in the global include directory of VStudio: Tools -> Option -> Projects & Solution -> VC++ Directories -> (Add your folders) OR

Delete Intellisense file (present in each project directory). It will be recreated by VStudio on reopening the project. (RECOMMENDED)