473,320 Members | 1,969 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,320 software developers and data experts.

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_arraywhile 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 1525
li*****@gmail.com 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_Keith) 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.googlegr oups.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.com 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
automatically 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.public.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
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...
1
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...
1
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
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...
22
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...
67
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...
2
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...
2
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
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...
1
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.