Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Susan Baker - 02 Jul 2005 13:12 GMT
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
Carl Daniel [VC++ MVP] - 02 Jul 2005 14:12 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> #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
[quoted text clipped - 10 lines]
>
> 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
Susan Baker - 02 Jul 2005 14:59 GMT
Thanks - I've got it sorted out now.

>>Hi,
>>
[quoted text clipped - 53 lines]
>
> -cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.