Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio can't 'see' my included header files

I created an empty 'Demo' project in Visual Studio 2008 and added some existing projects to my solution. Included "MyHeader.h" (other project's header) in main.cpp file which is in 'Demo'. Also added header files' path in "Tools/Option/VC++ Directories/Include files" section. But intellisense says: "File 'MyHeader.h' not found in current source file's directory or in build system paths..."

How the problem can be fixed? Thanks.

like image 276
Nabijon Avatar asked Sep 19 '12 07:09

Nabijon


People also ask

Where can I find header files in Visual Studio?

Visual Studio looks for headers in this order: In the current source directory. In the Additional Include Directories in the project properties (Project -> [project name] Properties, under C/C++ | General). In the Visual Studio C++ Include directories under Tools → Options → Projects and Solutions → VC++ Directories.

How do I include a .h file in Visual Studio?

Place your caret on the first line of any C# or Visual Basic file. Press Ctrl+. to trigger the Quick Actions and Refactorings menu. Select Add file header. To apply the file header to an entire project or solution, select Project or Solution under the Fix all occurrences in: option.

How do I view header files?

To check if an header file has been included or not in a C or C++ code, we need to check if the macro defined in the header file is being defined in the client code. Standard header files like math. h have their own unique macro (like _MATH_H ) which we need to check. Consider this example of checking if math.


Video Answer


1 Answers

Delete the .sdf file that is in your solution directory. It's just the Intellisense database, and Visual Studio will recreate it the next time you open that solution. This db can get corrupted and cause the IDE to not be able to find things, and since the compiler generates this information for itself on the fly, it wouldn't be affected.

like image 139
jake Avatar answered Oct 04 '22 11:10

jake