473,785 Members | 2,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search for built-in header and application header

Hi,
I always have an impression that for the following semantics:
#include <something e.g. #include <stdio.h>
Compiler searches it from built-in header search path, on UNIX, it
could be /usr/include, /bin/include.

And for the following semantics:
#include "someting" e.g. #include "mine.h"
Compiler searches it according to the -I command option and the
built-in search path.

But I just encountered a problem, it is Visual C++ compiler, it
seems for #include <type, it also search for -I path. And it
automatically add "include" to the end of -I path, here is an example:

I have -I c:/repo in VC compiler path and in my C code, I have:
#include <auto_arraywhil e the file actually locates at c:/repo/
include/auto_array, but VC compiler finds it.

Could you confirm 2 things:

1. Compiler searches builtin path and -I command option for both
"#include <>" and "#include "" " type include.

2. Compiler add "include" to the end of each search path named in -I
option.

Here is copy & paste from my compile command:

c:/msvsn2003/vc7/bin/cl.exe -W3 -Tp ../s/TestUtils.c -c -nologo -GR -
MDd -Ob2 -Zi -GX -DDEBUG -DNT -DNO_TCL_STUBS -FdlibTestUtils. pdb -
FplibTestUtils. pch -Ic:/repo -I../i
TestUtils.c

Thanks.

Aug 22 '07 #1
3 1549
li*****@gmail.c om writes:
I always have an impression that for the following semantics:
#include <something e.g. #include <stdio.h>
Compiler searches it from built-in header search path, on UNIX, it
could be /usr/include, /bin/include.

And for the following semantics:
#include "someting" e.g. #include "mine.h"
Compiler searches it according to the -I command option and the
built-in search path.

But I just encountered a problem, it is Visual C++ compiler,
[snip]

For '#include <foo.h>', the compiler "searches a sequence of
implementation-defined places" for the foo.h header. (Note that a
header needn't be a source file; for example, some compilers support
precompiled headers.)

For '#include "foo.h"', the compiler searches for a source file" in an
implementation-defined manner". If that search fails, it tries again
as if the argument were '<foo.h>'.

See C99 6.10.2 for the full statement of the rules. See
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdffor the
latest post-C99 draft (that section is identical in the actual C99
standard and in n1124).

I believe the behavior you describe is consistent with the (fairly
loose) requirements of the standard.

If you have questions about the behavior of the Visual C++ compiler,
you'll need to ask in a forum that discusses the Visual C++ compiler,
rather than just the C language.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 22 '07 #2

<li*****@gmail. comwrote in message
news:11******** **************@ z24g2000prh.goo glegroups.com.. .
Hi,
I always have an impression that for the following semantics:
#include <something e.g. #include <stdio.h>
Compiler searches it from built-in header search path, on UNIX, it
could be /usr/include, /bin/include.

And for the following semantics:
#include "someting" e.g. #include "mine.h"
Compiler searches it according to the -I command option and the
built-in search path.
exact details depend, but:
usually '<...>' searches the both the user and system specified include
directories;
usually "..." first searches in the path of the source file, maybe then
behaving like '<...>'.

Aug 22 '07 #3
On Wed, 22 Aug 2007 11:00:27 -0700, li*****@gmail.c om wrote:
snip
But I just encountered a problem, it is Visual C++ compiler, it
seems for #include <type, it also search for -I path. And it
automaticall y add "include" to the end of -I path, here is an example:
snip

Since your question has nothing to do with the language and everything
to do with your particular compiler, you will get better answers from
the microsoft.publi c.vc family of newsgroups.
Remove del for email
Aug 25 '07 #4

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

Similar topics

1
3119
by: Alex Elbert | last post by:
Hi I have built dynamic HTMLTable. Now I want to attach it directly to the Email Body - it is already built, so why not to use a ready table. However, I cannot find the way of getting plain HTML text out of dynamically built control. I tried to put my table between div and read div.innerHTML then - HTTP exception has been thrown. Any thoughts, ladies and gentelmen
1
1703
by: RiceGuy | last post by:
Hi! I'm looking for ideas on what would the best approach to design a search system for a RSS feeds. I will have some 50 RSS feeds (all RSS 2.0 compliant) stored locally on the web server. Now I'm wondering what would the best method to allow searching of these RSS files. Since the search will cater to multiple users the search system has to be robust and efficient. Some ideas that I have for the RSS search system are: 1. Store all RSS...
1
1628
by: Generic Usenet Account | last post by:
I had a need to tokenize a string, and this is what I came up with. Is this the most efficient way of tokenizing, or is a more efficient solution possible? Thanks, Gary
6
7775
by: bear220720 | last post by:
I have a big problem about how to make this C++ program. I was asked to use binary search tree to built a dictionary. This program must have some function, 1. Read a article file and include every word of it into the dictionary. 2. When enter a word, it can make a search and report the word where the search eventually stops. If anyone has this kind of program, please send to me. Thank you!
22
11124
by: Phlip | last post by:
C++ers: Here's an open ended STL question. What's the smarmiest most templated way to use <string>, <algorithms> etc. to turn this: " able search baker search charlie " into this: " able replace baker replace charlie "
67
6052
by: Sandy.Pittendrigh | last post by:
Here's a question I don't know the answer to: I have a friend who makes very expensive, hand-made bamboo flyrods. He's widely recognized (in the fishing industry) as one of the 3-5 'best' rod makers in the world. He gets (sic) close to $5000 per custom made flyrod. A surprising number of people buy these fishing rods and never use them....they buy them as art-like investments. He is, after all, the best there is. But if you search on...
2
1061
by: Jim | last post by:
My client wants to be able to search the content of his site that is built using ASP.net user controls that dynamically load into a single aspx page. The content is not dynamic, however. How would I go about sending this up, because I am not even sure where to start. As you can probably tell I am a little lost... :-(
2
2042
by: JP SIngh | last post by:
Hi All A tricky issue wonder if someone can help I have two tables like this TapeRecords TapeID - Integer Primary key Title - Text
1
1354
by: firewood | last post by:
I'm developing a PHP/MySQL site that will take images and text and automatically create a website from templates. I need a good search engine script to run separately on each of the websites that will be built using my script. (i.e. search only one website, not many). Does anyone have a recommendation for a good search engine?
1
328
by: Guillermo | last post by:
Hi! Is it possible to load the full-text search module for the SQLite version bundled with Python 2.5? I've tested it and the stand-alone SQLite distribution doesn't seem to include it (sqlite.load fts2), nor does Python. I'm on Windows XP.
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10346
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9956
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.