473,394 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

#include statement format

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?
Nov 17 '05 #1
5 829
It means "do not look in any of the %INCLUDE% directories, but look just
in the current directory".

--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
"charles hamm" <ha***********@epa.gov> wrote in message
news:6e**************************@posting.google.c om...
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?

Nov 17 '05 #2
> 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"
Nov 17 '05 #3
> 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.


--
Mihai
-------------------------
Replace _year_ with _ to get the real email
Nov 17 '05 #4
Ummm.. No.

http://msdn.microsoft.com/library/de..._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.
--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
"Mihai N." <nm**************@yahoo.com> wrote in message
news:Xn********************@216.148.227.77...
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.


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

Nov 17 '05 #5
> #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.
--
Mihai
-------------------------
Replace _year_ with _ to get the real email
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Recoura Tim | last post by:
Hello, I'm writing a shoppingcart program in PHP. The website of our suplliers webpage i written in ASP. He has very detailed info about his products, that I want to include in my PHP page, I...
8
by: Henri | last post by:
Hi, Is there a way to include a .js file inside a .js file in JavaScript 1.5? Thanx Henri
3
by: Gordon Moore | last post by:
Hi, I'm new to using xml/xslt and although I can create an xml document using the dataset.WriteXml statement, and I have created an xslt to transform the xml into the output I want, I have to...
9
by: zolli | last post by:
Hi, I've been banging my head against this for a while now. Hoping someone here can shed some light on what's going on. On including stdlib.h in a file, I'm seeing the following errors: ...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
14
by: Wescotte | last post by:
I have an application that uses several file formats for similar data. So I've created various php files for each format containing the same functions which produce the same end result. Now I...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
8
by: joakim.hove | last post by:
Hello, is it possible in python to include another python source file into the current namespace, i.e.completely analogous to the #include statement in C. Regards Joakim
7
by: Man-wai Chang | last post by:
Does HTML have an include file feature? -- .~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Ubuntu...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.