LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-02-2009, 07:07 AM   #1
icecubeflower
Member
 
Registered: Mar 2008
Location: USA
Distribution: Slackware 13.1
Posts: 304

Rep: Reputation: 33
object files, compiling, location


When you compile a program with standard header files like <iostream> it looks to me like the compiler never compiles any .cpp files for them so I assume the .o files are all stored somewhere so all the compiler does is link them. Is that right?

I did this:
Code:
root@inferno:/home/icecube# find / -name iostream
/usr/include/boost/tr1/tr1/iostream
/usr/include/c++/4.2.4/iostream
/usr/local/boost_1_38_0/boost/tr1/tr1/iostream
/usr/local/include/boost-1_38/boost/tr1/tr1/iostream
root@inferno:/home/icecube#
And I installed boost myself so I guess /usr/include/c++/4.2.4 is where the isostream header file is at.

How does g++ know where to look for standard header files? Does it use the same PATH ($PATH?) variable (I can't remember what it's called) that the shell uses when tries to find executable files like ls?
 
Old 04-02-2009, 08:42 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
1) $PATH is for executable's :/bin:/usr/bin:/usr/local/bin etc.

2) LD_LIBRARY_PATH is for libraries (:/lib:/usr/lib: .. etc.)

3) c++ (g++), gcc has a 'build in' path, knowing where to look :

when gcc, g++ is compiled with '--prefix=/usr', the path for the
includes is ( for g++) /usr/include/c++/4.x.x/ ....
for the '4.x.x' versions.
.....

Last edited by knudfl; 04-02-2009 at 08:44 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create shared libraries and configure shared object location vijaya_svk Programming 2 11-19-2007 01:30 PM
Retrieving location of shared object file (Linux, C++) ? fantas Programming 4 06-08-2007 07:18 AM
Compiling object file for kernel module yannifan Programming 2 02-25-2007 01:55 AM
problem with the location of some library files on Slackware 10.2 while compiling atk boris-78 Linux - Newbie 4 10-10-2006 02:13 PM
basic object compiling c++ ttucker Programming 9 09-17-2004 09:06 AM


All times are GMT -5. The time now is 07:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration