By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

Setting project include directories (VC 7.1): #include <file> vs#include "file"

P: n/a
Hi,

I am (trying) to compile some code I downloaded from the internet. The
sources contain references to header files - using the form :

#include <pathname/file>

If I change the form to this:

#include "pathname/file"

The file can be compiled. The only problem is that I do not want to edit
the original source files as above, I just want to set up the search
path (like you do by specifying with -I option when compiling with gcc ).

I have gone to the project properties (C/C++->General->Additional
Include) and set this to pathname - still no joy.

I need to know how to set up VC++ so that I can add pathname to my
search path, so that I can automatically compile code containing
preprocesser directives like:

#include <pathname/filename.h> // <- Note angled brackets

Any help wil be much appreciated. Thanks

Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Susan Baker wrote:
Hi,

I am (trying) to compile some code I downloaded from the internet. The
sources contain references to header files - using the form :

#include <pathname/file>

If I change the form to this:

#include "pathname/file"
.... which must mean that the file being included is being found by a path
that's relative to the location of the file containing the #include
directive, as that's the only difference between #include "file" and
#include <file>. e.g.

ProjDir/
foo.cpp contains #include <bar/baz.h>
bar/
baz.h

Traditionally, this would be considered an inappropriate use of #include <>
as that was intended to be for system supplied header files, while #include
" " was intended to be used for headers that are part of your project.

The file can be compiled. The only problem is that I do not want to
edit the original source files as above, I just want to set up the
search path (like you do by specifying with -I option when compiling with
gcc ).
I have gone to the project properties (C/C++->General->Additional
Include) and set this to pathname - still no joy.

I need to know how to set up VC++ so that I can add pathname to my
search path, so that I can automatically compile code containing
preprocesser directives like:

#include <pathname/filename.h> // <- Note angled brackets

Any help wil be much appreciated. Thanks


In the solution explorer, right-click on the project node and choose
Properties from the context menu. Find the C/C++/General node in the
tree-view of the properties window. Select All Configurations from the
Configuration combo-box at the top left of the dialog. In the Additional
Include Directories box, type $(ProjectDir). If there are already one or
more directories listed there, use a semi-colon to separate directories (the
UI will accept space-delimitted directories as well, but they won't be
searched properly - the compiler will see it as one long path). You can
also click on the little [...] button on the far-right of the edit box to
bring up a dialog that lets you build paths from the available project
macros and automatically adds the semicolon delimitters as well.

If that doesn't get you going, please reply with a description of the
directory structure of the project, including the locations of the file that
contains the #include as well as the file named in the #include.

-cd
Nov 17 '05 #2

P: n/a
Thanks - I've got it sorted out now.

Carl Daniel [VC++ MVP] wrote:
Susan Baker wrote:
Hi,

I am (trying) to compile some code I downloaded from the internet. The
sources contain references to header files - using the form :

#include <pathname/file>

If I change the form to this:

#include "pathname/file"

... which must mean that the file being included is being found by a path
that's relative to the location of the file containing the #include
directive, as that's the only difference between #include "file" and
#include <file>. e.g.

ProjDir/
foo.cpp contains #include <bar/baz.h>
bar/
baz.h

Traditionally, this would be considered an inappropriate use of #include <>
as that was intended to be for system supplied header files, while #include
" " was intended to be used for headers that are part of your project.

The file can be compiled. The only problem is that I do not want to
edit the original source files as above, I just want to set up the
search path (like you do by specifying with -I option when compiling with
gcc ).
I have gone to the project properties (C/C++->General->Additional
Include) and set this to pathname - still no joy.

I need to know how to set up VC++ so that I can add pathname to my
search path, so that I can automatically compile code containing
preprocesser directives like:

#include <pathname/filename.h> // <- Note angled brackets

Any help wil be much appreciated. Thanks

In the solution explorer, right-click on the project node and choose
Properties from the context menu. Find the C/C++/General node in the
tree-view of the properties window. Select All Configurations from the
Configuration combo-box at the top left of the dialog. In the Additional
Include Directories box, type $(ProjectDir). If there are already one or
more directories listed there, use a semi-colon to separate directories (the
UI will accept space-delimitted directories as well, but they won't be
searched properly - the compiler will see it as one long path). You can
also click on the little [...] button on the far-right of the edit box to
bring up a dialog that lets you build paths from the available project
macros and automatically adds the semicolon delimitters as well.

If that doesn't get you going, please reply with a description of the
directory structure of the project, including the locations of the file that
contains the #include as well as the file named in the #include.

-cd


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.