🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41835

Re: GCC won't Link with Math functions

#41835
From: Mark P. Nelson
Date: Mon, 05 Feb 1996 00:00
17 lines
1106 bytes
Kelly Edwards (74127.3014@CompuServe.COM) wrote:
: I am using gcc running under the Slackware version 2.2.0 of 
: Linux.  I have been attempting to compile and link a c program 
: which includes several math functions such as cos, floor, pow, 
: etc.  I keep getting undefined reference to cos (etc) messages.  

: Specifics include:
: - I am compiling using gcc -g -lm -o output_name name.c

Try this instead:

gcc -g -static name.c -o output_name -lm

--
Mark P. Nelson
Programmer/Analyst II        --        First you program, then you analyze.
Department of Integrative Biology, Thomson Laboratory
Technical Details
Message-ID: <4f5pli$p70@agate.berkeley.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4etf9j$c75$1@mhafc.production.compuserve.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,c8c72a5da0bb27a7
X-Google-Attributes: gid11318c,public
From: mpn@biol.berkely.edu (Mark P. Nelson)
Subject: Re: GCC won't Link with Math functions
Date: 1996/02/05
Message-ID: <4f5pli$p70@agate.berkeley.edu>
X-Deja-AN: 138141475
references: <4etf9j$c75$1@mhafc.production.compuserve.com>
organization: Dept. of Integrative Biology: Thomson Lab.
reply-to: mpn@alleleb.biol.berkeley.edu
newsgroups: gnu.gcc.help