LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 08-19-2011, 02:33 AM   #1
ethereal1m
Member
 
Registered: Jan 2010
Distribution: slackware 13.0 64
Posts: 259

Rep: Reputation: 30
Question Shared library for GNU compiler GCC


Dear all,
How can I check which shared library that GNU compiler look at? And also how can I add a shared library to the compiler?

Suppose my program requires stdio.h, but I don't know which version of stdio.h that the compiler looks at since there are multiple files that named stdio.h.

Also if there's a library that I want to add to the shared, how can I do that?

Could anybody point me to a documentation that explains this thoroughly?

best regards,
ethereal1m
 
Old 08-19-2011, 04:28 AM   #2
farshidlk
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Rep: Reputation: Disabled
ethereal1m,

If I get you right:

If there are multiple files, one of them is usually a Symbolic link that refers to the a real shared object. for instance if you need a shared object named sharedobj.so.3 but there are sharedobj.so.7 and sharedobj.so.9 available in the system as well, there would be a file called sharedobj.so which is a sym link that refers to one of the mentioned 3 files. You can find the mapping by "ls -l" command and if needed change it to the shared object that you need.

for adding shared object to the library see: http://tldp.org/HOWTO/Program-Librar...libraries.html


hope that helps
 
1 members found this post helpful.
Old 08-19-2011, 04:45 AM   #3
ethereal1m
Member
 
Registered: Jan 2010
Distribution: slackware 13.0 64
Posts: 259

Original Poster
Rep: Reputation: 30
Ok,
I was actually thinking about "include files" (like stdio.h, iostream, etc), not shared objects file. Hmmm, can we call include files shared libraries? or we just call them "include files". Include files are usually under /usr/include. And my stdio.h files are multiple in that location.

How can I now which "include files" the gcc uses? Sorry for the mix up...
 
Old 08-19-2011, 05:49 AM   #4
ninis666
LQ Newbie
 
Registered: Aug 2011
Posts: 5

Rep: Reputation: Disabled
Hi,

You can use the -E option to let only the preprocessor work : gcc -E myfile.c
 
1 members found this post helpful.
Old 08-19-2011, 05:59 AM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by ethereal1m View Post
Ok,
I was actually thinking about "include files" (like stdio.h, iostream, etc), not shared objects file. Hmmm, can we call include files shared libraries? or we just call them "include files". Include files are usually under /usr/include. And my stdio.h files are multiple in that location.

How can I now which "include files" the gcc uses? Sorry for the mix up...
They're called header files, not shared libraries. What do you mean by, "my stdio.h files are multiple in that location"? Are you saying that you have multiple files with the same name in a given directory?

The specific directories that gcc looks in for header files are defined when it is built. From the man page:

Code:
  CPATH
  C_INCLUDE_PATH
  CPLUS_INCLUDE_PATH
  OBJC_INCLUDE_PATH
           Each variable's value is a list of directories separated by a
           special character, much like PATH, in which to look for header
           files.  The special character, "PATH_SEPARATOR", is target-
           dependent and determined at GCC build time.  For Microsoft Windows-
           based targets it is a semicolon, and for almost all other targets
           it is a colon.
There's more text there that you may want to read. If you want to specify other directories in which to look, use the -I option.
 
1 members found this post helpful.
Old 08-19-2011, 06:23 AM   #6
ethereal1m
Member
 
Registered: Jan 2010
Distribution: slackware 13.0 64
Posts: 259

Original Poster
Rep: Reputation: 30
aaa, ok, thanks you guys...
 
  


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
GNU Make and GNU GCC DEBUG vs RELEASE compiler options aryan1 Programming 1 01-12-2010 01:29 PM
[SOLVED] need help with GNU CC (GCC) compiler smeezekitty Programming 6 09-21-2009 03:24 AM
gcc link shared library against another shared library qcp Linux - Newbie 1 07-25-2008 12:15 PM
How to tell compiler to not to use GNU library (glibc) P.S.R.K.S.PRASAD Linux - Kernel 1 12-27-2006 03:58 AM
GNU gcc 3 compiler Craneology Linux - Software 3 03-04-2003 05:35 AM


All times are GMT -5. The time now is 02:49 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