This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using Math Functions
- From: Tkil <tkil at scrye dot com>
- To: calvesmit at ig dot com dot br
- Cc: gcc at gcc dot gnu dot org
- Date: 04 Mar 2003 00:12:05 -0700
- Subject: Re: Using Math Functions
- References: <gfzq31xed.fsf@totally-fudged-out-message-id><g8yvv1upf.fsf@brand.scrye.com>
- Reply-to: Tkil <tkil at scrye dot com>
>>>>> "Tkil" == tkil <tkil at scrye dot com> writes:
Tkil> Or, if you have multiple files:
Tkil> gcc -c my_lib.c
Tkil> gcc -c my_prog.c
Tkil> gcc -o my_prog my_lib.o my_prog.o -lm
^^^^^^^^ ^^^^^^^^^^
Open foot, insert mouth. Assuming my_prog.c calls routines in
my_lib.c, it needs to be the other way around:
gcc -o my_prog my_prog.o my_lib.o -lm
Tkil> Note that "-lm" should be after any of your object files that
Tkil> use functions from it, as symbols are resolved from
Tkil> left-to-right on the command line.
I even knew that.
t.