473,480 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

list #include path ?

Struggling newbe here, some of my #includes work, some dont. Is it
possible to list the include path ? (in BASH),

I have looked at the environmental variables (loads of them) but
cannot find a reference.

Cheers

Dave

May 21 '07 #1
2 3763
* da******@googlemail.com:
Struggling newbe here, some of my #includes work, some dont. Is it
possible to list the include path ? (in BASH),

I have looked at the environmental variables (loads of them) but
cannot find a reference.
As I understand it you want to specify the include path in the source code.

That's formally implementation specific, but most implementations (even
for Windows) support Unix-style forward slashes as path element
separators, so you can write

#include <someplace/wherever/theheader.h>
#include "someplaceelse/theotherheader.h"

The formal difference is that the "..." performs some extra searching
first, and if that doesn't find the header, does the same as <...>.

The in-practice difference is that the extra searching is in the
directory of the file containing the #include directive, i.e., "..."
will pick up a local file if there is one.

If instead you meant, how to find out the paths of the files actually
included, then that is implementation specific and generally off-topic
in clc++m. But e.g. g++ has the option "--print-search-dirs". I've
never used it, I just looked at the compilers short help listing, and
that's the general advice for implementation- and environment-specific
question (if that's what this was): read the manual, whatever you have.

Hth.,

- Alf

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
May 21 '07 #2
On May 21, 10:44 pm, "Alf P. Steinbach" <a...@start.nowrote:
* dave6...@googlemail.com:
Struggling newbe here, some of my #includes work, some dont. Is it
possible to list the include path ? (in BASH),
I have looked at the environmental variables (loads of them) but
cannot find a reference.
As I understand it you want to specify the include path in the source code.
I'm not sure if that's what he wants. I think (but I'm not sure
either) that what he wants is to know where the compiler is
looking. Which is obviously implementation specific: g++ has an
option -print-search-dirs, and also an option -v which will show
the full paths (including those you specified by means of -I)
passed to the preprocessor, during a real compilation. (Note
that these paths are generally fixed during the generation of
g++, and may vary from one installation to the next.) VC++, as
far as I can tell, doesn't have anything "fixed", but depends on
$INCLUDE (or rather %INCLUDE%)---which again will vary depending
on where you install the compiler (and the system libraries,
which aren't bundled with the system or the compiler).
That's formally implementation specific, but most implementations (even
for Windows) support Unix-style forward slashes as path element
separators,
Just a nit, but Windows itself recognizes '/' as a directory
separator, at the lowest level. (Some utilities, however, will
not accept it in command line arguments, interpreting it as an
option specifier.)
so you can write
#include <someplace/wherever/theheader.h>
#include "someplaceelse/theotherheader.h"
The formal difference is that the "..." performs some extra searching
first, and if that doesn't find the header, does the same as <...>.
The in-practice difference is that the extra searching is in the
directory of the file containing the #include directive, i.e., "..."
will pick up a local file if there is one.
G++ (and probably others) also allows specifying paths in the
command line which are only searched for "..." includes.
If instead you meant, how to find out the paths of the files actually
included, then that is implementation specific and generally off-topic
in clc++m.
If he's concerned about where some symbol is actually coming
from, all of the compilers I know accept -E (or /E under
Windows), to output the preprocessor output to standard out.
This output normally contains #line directives with the full
path name; I've found this useful more than once to find out
where some strange symbol is coming from. (Or more often, to
discover that some header has unexpectedly defined a macro with
a name that conflicted with something I was trying to use.)
But e.g. g++ has the option "--print-search-dirs". I've
never used it, I just looked at the compilers short help listing, and
that's the general advice for implementation- and environment-specific
question (if that's what this was): read the manual, whatever you have.
The correct answer to all of this should be "read the manual".
In practice, however... most compiler documentation is pretty
poor.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

May 22 '07 #3

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

Similar topics

43
5037
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
2
1878
by: Marcus | last post by:
Hello, I am having problems with an include statement. I'm setting a session variable flag and then including a file, and in that include file I have a check at the top to make sure that the...
2
3530
by: Zyron | last post by:
Hello! I'm developing a web page that has a goal of providing personal content, which means that all information should be written in their own language. I'm about to finish my Geo targeting...
3
7723
by: Amit | last post by:
Hi when I try to run LIST ACTIVE DATABASES AT DBPARTITIONNUM <partnum> or LIST ACTIVE DATABASES GLOBAL, I always get an error message. Does anyone know why? I'm on v8 fp 5 output : db2 => list...
5
1719
by: Simon Mansfield | last post by:
Im trying to read in a list of employee's from a file, in the format: 01:SJM:Programmer:481 (<- £4.81 an hr) 02:AMG:Python Scripter:512 : : etc. When assigning to the "new" pointer it...
13
1599
by: placid | last post by:
Hi all, I was just if anyone knows a way to resolve a list of integers say {1,2,3,4,5} into a range that is 1-5? #include <stdlib.h> #include <stdio.h> #include <ctype.h> int main(int...
8
1721
by: Daz | last post by:
Hi everyone. I just wanted to know if there was any way to use script to display a list of methods linked to a particular object? The object I have in mind is getBrowser(), and I can't seem to...
4
7659
by: JB | last post by:
I am trying to get a list of all the active computers running on my domain. I'm writing some remote management style software with WMI, which works fine when i know the computer name, but i just...
6
4141
by: tgnelson85 | last post by:
Hello, C question here (running on Linux, though there should be no platform specific code). After reading through a few examples, and following one in a book, for linked lists i thought i would...
0
7041
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
6908
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...
1
6739
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
6929
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...
0
5337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4779
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4481
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...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
181
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...

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.