LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Shared library for GNU compiler GCC (https://www.linuxquestions.org/questions/linux-newbie-8/shared-library-for-gnu-compiler-gcc-898224/)

ethereal1m 08-19-2011 01:33 AM

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

farshidlk 08-19-2011 03:28 AM

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

ethereal1m 08-19-2011 03:45 AM

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...

ninis666 08-19-2011 04:49 AM

Hi,

You can use the -E option to let only the preprocessor work : gcc -E myfile.c

Nylex 08-19-2011 04:59 AM

Quote:

Originally Posted by ethereal1m (Post 4447539)
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.

ethereal1m 08-19-2011 05:23 AM

aaa, ok, thanks you guys...


All times are GMT -5. The time now is 04:33 PM.