This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Documentation comments...


> I've been working on compiling a program on our Sun that was working and 
> then we added a call to sqrt and broke the link.

When you say Sun, do you mean the "Solaris" operating system as
manufactured by Sun Microsystems?

> The URL for this reference is
> http://www.delorie.com/djgpp/doc/libc-2.02/.

If this is Sun Solaris, this reference is of no relevance; it explains
a library for use on the Microsoft DOS operating system. The C library
you are using is part of the Solaris system, and so is the
documentation for that library.

> From there I've searched the on-line documentation for information
> about sqrt.

Did you try to type 'man sqrt'?

> To say it was sparse would be an understatement.  Finally after a
> bit of searching I sent an email (below) which was answered in about
> 5 minutes with the obvious fix of: link with -lm.

For me, the sqrt(3M) documentations starts with

  cc [ flag ... ] file ...  -lm [ library ... ]

which tells you to pass -lm to the compiler. Also, if you do
'man -s3 intro', you get a fragment

     (3M)  These functions constitute  the  math  library,  libm.
           This  library  is  implemented  as  a  shared  object,
           libm.so,  and  as  an  archive,  libm.a,  but  is  not
           automatically  linked  by  the  C  compilation system.
           Specify -lm on the cc command line to link  with  this
           library.

> My comment overall is that I shouldn't have had to dig through so
> much documentation without finding what appears now to be an obvious
> point.

You don't have to. Just read any book about the Unix system, and it
tells you about the online manual system right away.

Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]