[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: online help on c/c++ functions/libraries



Micha Feigin <kamikaza_mic@yahoo.com> writes:
MF> How do I get help on c/c++ functions, including the library (.h) file
MF> for them?
MF> man query etc. ? (how do i search for it?)

Functions in the standard C library generally have man pages in
sections 2 or 3.

Also, a terminology clarification that will probably save you some
trouble: *.h files are *not* libraries.  The *.h files are C (or C++)
"include" files, which contain valid C (or C++) code that are
generally declarations for things that exist in some library (possibly 
the standard C library).  These generally live in /usr/include.
"Library" files are *.a and *.so files that live in /lib or /usr/lib,
and contain the actual compiled code for the library.

So to successfully use a library, you need to #include the correct
header files from your source file(s), and you need to link your
binary against the actual library with the -l switch.  As a simple
example, the sin() function is in the standard math library (libm.so), 
and its prototype is in the math.h header file, so your source would
have "#include <math.h>" in it, and you'd link with 'cc -lm foo.o'.

MF> Is it possible to get a list of functions available on the system,
MF> and/or a list of available c libraries (.h) and their coresponding
MF> funcions?

Try 'ls /usr/include' for a start, and looking at the contents of the
various header files.

-- 
David Maze             dmaze@mit.edu          http://donut.mit.edu/dmaze/
"Hey, Doug, do you mind if I push the Emergency Booth Self-Destruct Button?"
"Oh, sure, Dave, whatever...you _do_ know what that does, right?"


Reply to: