From: Glynn Clements <glynn.clements@virgin.net>
To: adwin <fox@sby.centrin.net.id>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Re[2]: start learning gcc ... how to ?
Date: Tue, 9 Apr 2002 23:09:49 +0100 [thread overview]
Message-ID: <15539.26285.354426.644344@cerise.nosuchdomain.co.uk> (raw)
In-Reply-To: <1913993471.20020409230118@sby.centrin.net.id>
adwin wrote:
> MG> gcc has lots of options, but theses are (almost) all I've needed:
> MG> -Wall (Warnings:ALL)
> MG> -g (generate debug info)
> MG> -ggdb (idem but with gdb extensions)
> MG> -o (output to file)
> MG> -c (compile only, don't link for makeing .o)
> MG> -ansi (kindda obvious)
> MG> Well, I know is little but it might help you to start
>
> how about with -l option ? (for library). I still don't understand
> when I have to use this option and when I don't need to use it.
> for example for compiling program that use math.h,it need -lm and when
> you create a program with QT library you need to use -lqt and -lglut
> for opengl etc etc ...
If you use functions from a particular library, you use -l to specify
that library. However, "gcc" includes "-lc" automatically, and "g++"
includes "-lc -lstdc++" automatically.
The argument to "-l" is the name of the library, without the "lib"
prefix or any suffixes. E.g. "-lX11" will link against libX11.so
(shared library) or libX11.a (static library). If the library isn't in
a standard directory (/lib or /usr/lib), you also need to specify the
directory with "-L" (e.g. "-L/usr/X11R6/lib" for X libraries).
> MG> I'd strongly recomend you reading a make tutorial
>
> do you mean gnu automake and autoconf tutorial ?
No, he means a tutorial for "make". This is the program which is
normally used to control compilation. If you are building a program
from multiple source files, you don't want to type lots of "gcc"
commands manually. See "info make" (or, if you are using Emacs,
"C-h C-i make RET").
--
Glynn Clements <glynn.clements@virgin.net>
prev parent reply other threads:[~2002-04-09 22:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-09 11:50 start learning gcc ... how to ? fox
2002-04-09 13:04 ` Miguel Griffa
2002-04-09 16:01 ` Re[2]: " adwin
2002-04-09 16:34 ` Elias Athanasopoulos
[not found] ` <1018533665.9524.5.camel@abodh.lan.deeproot.co.in>
2002-04-12 9:22 ` Elias Athanasopoulos
2002-04-09 22:09 ` Glynn Clements [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15539.26285.354426.644344@cerise.nosuchdomain.co.uk \
--to=glynn.clements@virgin.net \
--cc=fox@sby.centrin.net.id \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).