views:

401

answers:

1

Hi all,

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?

Thank you very much in advance!

+1  A: 

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)

Ganesh R.
This worked a treat. Thank you so much!