473,841 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
+ 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 3799
* da******@google mail.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 "someplacee lse/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.now rote:
* dave6...@google mail.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 "someplacee lse/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 objektorientier ter Datenverarbeitu ng
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
5147
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 relative NOT to the immediate script that is including it, but is relative to the top-level calling script. In practice, this means that you have to constantly worry and adjust paths in includes, based on the startup scripts that call these...
2
1891
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 session variable is set, otherwise I stop executing and redirect. My problem is that this works if I use a relative path to the include file, but not if I use the full path. If I use the full path, it does not read the session flag as being set,...
2
3567
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 system that will identify where the users are coming from based on their IP address, and for this project I would really like to replace the English country list with a list of the country in the local language. I'm been around on
3
7767
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 active databases at dbpartitionnum 1; SQL0104N An unexpected token "1" was found following "<identifier>". Expected tokens may include: "GLOBAL". SQLSTATE=42601 db2 => list active databases at GLOBAL;
5
1742
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 brings up an assignment error on line 33 and 34 of Staff.c, now these are the two string fields.. But I dont see
13
1628
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 argc, char*argv)
8
1748
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 find any documentation online with regards to it's methods. Also, as I am learning, it would be nice to be able to know what methods are available for a particular object/function, without necessarily having to spend a while looking up an...
4
7704
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 want to be able to produce a list and work it from there. I found the following method: String path = "WinNT://MY.DOMAIN.COM"; String username = "administrator";
6
4162
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 try my own small program. The problem is, I seem to be having trouble with memory, i.e. sometimes my program will work and display the correct output, and sometimes it will not and display garbage (in a printf call) so i assume i have been using...
0
9865
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9706
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
10932
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
10609
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...
1
10667
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9446
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7851
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7025
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
5881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.