views:

5847

answers:

3

Okay, C++ newbie question here. I checked out a copy of a C++ application from SourceForge (HoboCopy, if you're curious) and tried to compile it, but Visual Studio tells me that it can't find a particular header file. I found the file in the source tree, but where do I need to put it so that it will be found when compiling? Are there special directories?

A: 

You need to tell Visual Studio where to look for the headers.

Look in the options, there it should be somewhere. I cannot tell you exactly where since i don't have it at hand right now.

Burkhard
+4  A: 

If the project came with a Visual Studio project file, then that should already be configured to find the headers for you. If not, you'll have to add the include file directory to the project settings by right-clicking the project and selecting Properties, clicking on "C/C++", and adding the directory containing the include files to the "Additional Include Directories" edit box.

Adam Rosenfield
+9  A: 

Visual Studio looks for headers in this order

  • in the current source directory
  • in the Additional Include Directories in the project properties. (Under C++ | General)
  • in the Visual Studio C++ Include directories under Tools | Options | Projects and Solutions | VC++ Directories.

In your case, add the directory that the header is in to the project properties.

Rob Prouse