🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42039

gcc compiler/linker question

#42039
From: lanx
Date: Wed, 17 Jan 1996 00:00
21 lines
1158 bytes
I installed gcc together with Linux from the Linux Slackware package. The
bin, include and lib directories are directly under /usr, which is different
from what you described for a separate installation in which they should be
under /usr/local. Anyway, gcc generally works except it can not find the
intrinsic functions (like sin, sqrt, etc.) that need <math.h>. My test
program is like this:

#include <stdio.h>
#include <math.h>
main()
{
 double x;
 x=sin(3.14159/6.0);
 printf("x=%f\n",x);
}

when I used gcc to compile and link the program, it gave me an error message:
/tmp/xxxxxxxx:   undefined reference to 'sin'
I checked /usr/include directory, both stdio.h and math.h are there! Do you
know what the problem is? Please help me.
Jian
Technical Details
Message-ID: <9601170739.AA21890@saluki-mail.fiber2.siu.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,e36285420ed23a4f
X-Google-Attributes: gid11318c,public
From: lanx@siu.EDU
Subject: gcc compiler/linker question
Date: 1996/01/17
Message-ID: <9601170739.AA21890@saluki-mail.fiber2.siu.edu>
X-Deja-AN: 135645762
distribution: gnu
sender: daemon@cis.ohio-state.edu
organization: GNUs Not Usenet
newsgroups: gnu.gcc.help