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++ / October 2004

Tip: Looking for answers? Try searching our database.

#include statement format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
charles hamm - 12 Oct 2004 18:21 GMT
When I generate a new class with VS.NET/C++, the #include statement
that VS puts in the .cpp file to reference the .h file uses ".\" as
the directory spec. My understanding of Windows directory specs
indicates that this is superflous. Is there something I am missing?
James Curran - 12 Oct 2004 18:32 GMT
   It means "do not look in any of the %INCLUDE% directories, but look just
in the current directory".

Signature

Truth,
James Curran
Home: www.noveltheory.com       Work: www.njtheater.com
Blog: www.honestillusion.com  Day Job: www.partsearch.com
                                               (note new day job!)

> When I generate a new class with VS.NET/C++, the #include statement
> that VS puts in the .cpp file to reference the .h file uses ".\" as
> the directory spec. My understanding of Windows directory specs
> indicates that this is superflous. Is there something I am missing?
Mihai N. - 13 Oct 2004 06:24 GMT
> It means "do not look in any of the %INCLUDE% directories, but look just
> in the current directory".
I am not sure this is the case, but if it is, this is one of the MS things.

The rules are clear (since K&R):

#include "filename.h" // includes from the current folder only
#include <filename.h> // includes from the current folder only
                     // or from %INCLUDE%

MS always did search in the INCLUDE paths for "...", but it seems that
Dev. Studio .NET (2002 & 2003) does not do it anymore.
In general, Dev.Studio.NET is much nicer in following the standards.

Signature

Mihai
-------------------------
Replace _year_ with _ to get the real email

James Curran - 13 Oct 2004 16:05 GMT
   Ummm.. No.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_pr
edir_The_.23.include_Directive.asp


#include "filename.h" // Looks in current directory, then from %INCLUDE%
#include <filename.h> // looks in %INCLUDE% only.

And, I pretty sure that K&R takes no stand on the matter at all.

The ISO C & C++ Standards (which appear to be identical on this matter) say
only that searching is implementation defined, and that the "filename.h"
must do the same search as the <filename.h> form, but may do a different
search first.

Signature

Truth,
James Curran
Home: www.noveltheory.com       Work: www.njtheater.com
Blog: www.honestillusion.com  Day Job: www.partsearch.com
                                               (note new day job!)

> > It means "do not look in any of the %INCLUDE% directories, but look just
> > in the current directory".
[quoted text clipped - 9 lines]
> Dev. Studio .NET (2002 & 2003) does not do it anymore.
> In general, Dev.Studio.NET is much nicer in following the standards.
Mihai N. - 14 Oct 2004 06:45 GMT
> #include "filename.h" // Looks in current directory, then from %INCLUDE%
> #include <filename.h> // looks in %INCLUDE% only.

> The ISO C & C++ Standards (which appear to be identical on this matter) say
> only that searching is implementation defined, and that the "filename.h"
> must do the same search as the <filename.h> form, but may do a different
> search first.

True. Checked it and you are right.

I did switch to Dev. Studio .NET a while ago and I did forgot what Dev.
Studio 6 was doing wrong.

It was looking in the current folder even for #include <...>.
Otherwise it was correct.

And now Dev. Studio NET is 100% correct.

Signature

Mihai
-------------------------
Replace _year_ with _ to get the real email

Gabest - 12 Oct 2004 18:36 GMT
> When I generate a new class with VS.NET/C++, the #include statement
> that VS puts in the .cpp file to reference the .h file uses ".\" as
> the directory spec. My understanding of Windows directory specs
> indicates that this is superflous. Is there something I am missing?

Moreover, it really likes to re-add it even if there was an include
"something.h" already, without the leading .\ ! My cpp files usually start
like this:

#include "something.h"
#include ".\something.h"

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.