public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* math.h problem
@ 2003-01-13 15:28 Anant Aneja
  2003-01-13 16:09 ` Fabio Mazzone
  0 siblings, 1 reply; 6+ messages in thread
From: Anant Aneja @ 2003-01-13 15:28 UTC (permalink / raw)
  To: gcc-help

Hi all,
I recently instatalled gcc version 2.96 on my Pentium 2 350 Mhz 
running PCQLinux (just
Red Hat 7.1 renamed)

I could get string.h,ctype.h to work but am havin problems with 
math.h

I by chance stumbled to a query posted in Aug 2001 reagarding a 
similar problem with math.h
I read ur reply and so am supplying u with all the details. Tell 
me what is wrong.

file mtest.c :
------mtest.c--------------
#include <math.h>

int main(void)
{
double n;

   n = sqrt(2);
   return (int)n - 1;
}
----------------------------

command run :
  gcc -v mtest.c -o mtest

o/p:
---------Starts----------
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c -v 
-D__GNUC__=2 -D__GNUC_M
INOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux 
-D__ELF__ -D__unix__
-D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386) 
-Amachine(i386) -Di38
6 -D__i386 -D__i386__ -D__tune_i386__ mtest.c /tmp/ccBL7IJ3.i
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) (cpplib) 
(i386 Linux/E
LF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
  /usr/include
End of search list.
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1 /tmp/ccBL7IJ3.i 
-quiet -dumpbase mt
est.c -version -o /tmp/cc1gOa36.s
GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) 
(i386-redhat-linux) comp
iled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-81).
  as -V -Qy -o /tmp/ccu4nMfe.o /tmp/cc1gOa36.s
GNU assembler version 2.10.91 (i386-redhat-linux) using BFD 
version 2.10.91.0.2
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/collect2 -m elf_i386 
-dynamic-linker /l
ib/ld-linux.so.2 -o mtest 
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.
o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crti.o 
/usr/lib/gcc-lib/i386-
redhat-linux/2.96/crtbegin.o 
-L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -L/usr/li
b/gcc-lib/i386-redhat-linux/2.96/../../.. /tmp/ccu4nMfe.o -lgcc 
-lc -lgcc /usr/l
ib/gcc-lib/i386-redhat-linux/2.96/crtend.o 
/usr/lib/gcc-lib/i386-redhat-linux/2.
96/../../../crtn.o
/tmp/ccu4nMfe.o: In function `main':
/tmp/ccu4nMfe.o(.text+0x11): undefined reference to `sqrt'
collect2: ld returned 1 exit status

----------Ends------------

command :
  gcc -v mtest.c -o mtest.i -E

o/p:
----------Starts------------
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c -v 
-D__GNUC__=2 -D__GNUC_M
INOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux 
-D__ELF__ -D__unix__
-D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386) 
-Amachine(i386) -Di38
6 -D__i386 -D__i386__ -D__tune_i386__ mtest.c /tmp/ccBL7IJ3.i
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) (cpplib) 
(i386 Linux/E
LF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
  /usr/include
End of search list.
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1 /tmp/ccBL7IJ3.i 
-quiet -dumpbase mt
est.c -version -o /tmp/cc1gOa36.s
GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) 
(i386-redhat-linux) comp
iled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-81).
  as -V -Qy -o /tmp/ccu4nMfe.o /tmp/cc1gOa36.s
GNU assembler version 2.10.91 (i386-redhat-linux) using BFD 
version 2.10.91.0.2
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/collect2 -m elf_i386 
-dynamic-linker /l
ib/ld-linux.so.2 -o mtest 
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.
o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crti.o 
/usr/lib/gcc-lib/i386-
redhat-linux/2.96/crtbegin.o 
-L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -L/usr/li
b/gcc-lib/i386-redhat-linux/2.96/../../.. /tmp/ccu4nMfe.o -lgcc 
-lc -lgcc /usr/l
ib/gcc-lib/i386-redhat-linux/2.96/crtend.o 
/usr/lib/gcc-lib/i386-redhat-linux/2.
96/../../../crtn.o
/tmp/ccu4nMfe.o: In function `main':
/tmp/ccu4nMfe.o(.text+0x11): undefined reference to `sqrt'
collect2: ld returned 1 exit status
[anant@aneja anant]$ cat > op.txt
[anant@aneja anant]$ gcc -v mtest.c -o mtest
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c -v 
-D__GNUC__=2 -D__GNUC_M
INOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux 
-D__ELF__ -D__unix__
-D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386) 
-Amachine(i386) -Di38
6 -D__i386 -D__i386__ -D__tune_i386__ mtest.c /tmp/ccBL7IJ3.i
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) (cpplib) 
(i386 Linux/E
LF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
  /usr/include
End of search list.
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1 /tmp/ccBL7IJ3.i 
-quiet -dumpbase mt
est.c -version -o /tmp/cc1gOa36.s
GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) 
(i386-redhat-linux) comp
iled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-81).
  as -V -Qy -o /tmp/ccu4nMfe.o /tmp/cc1gOa36.s
GNU assembler version 2.10.91 (i386-redhat-linux) using BFD 
version 2.10.91.0.2
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/collect2 -m elf_i386 
-dynamic-linker /l
[anant@aneja anant]$ gcc -v mtest.c -o mtest.i -E
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c -v 
-D__GNUC__=2 -D__GNUC_M
INOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux 
-D__ELF__ -D__unix__
-D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386) 
-Amachine(i386) -Di38
6 -D__i386 -D__i386__ -D__tune_i386__ mtest.c -o mtest.i
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) (cpplib) 
(i386 Linux/E
LF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
  /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
  /usr/include
End of search list.

-------------Ends-----------

A similar problem occurs on using iostream.h :

-------iotest.cpp--------
#include <iostream.h>

void main()
{
char a;
cin>>a;
}
-----------Ends------------

on givin :
gcc iotest.cpp i get :
------Starts-----------
/tmp/ccBRsi6r.o: In function `main':
/tmp/ccBRsi6r.o(.text+0xe): undefined reference to `cin'
/tmp/ccBRsi6r.o(.text+0x13): undefined reference to 
`istream::operator>>(char &)'
collect2: ld returned 1 exit status

----------Ends---------

Basically as u must have noticed the problem is a "undefined 
refreance to <func. name>"

Hoping u'll help me,
Anant Aneja

anantaneja@rediffmail.com
anantaneja@yahoo.com



^ permalink raw reply	[flat|nested] 6+ messages in thread
* math.h problem
@ 2003-09-22 16:46 Joe Taylor
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Taylor @ 2003-09-22 16:46 UTC (permalink / raw)
  To: gcc-help

I'm running Solaris 8 and gcc3.3 for some reason I can't get math.h
calls to work. none of the trig functions work.  I have checked the path
and it is ok. I have called the path out in the include statement. I
have searched the machine for other math.h files there is one in the
/usr/include dir and one in the gcc path.  I have tried both of them
neither work.  Odd problem? Any ideas?


**********CONFIDENTIALITY NOTICE**********
The information contained in this e-mail may be confidential and/or 
privileged and is intended for the sole use of the individual or 
organization named above.  If you are not the intended recipient or an 
authorized representative of the intended recipient, any review, copying
or distribution of this e-mail and its attachments, if any, is prohibited.
If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete this message from your system.

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: math.h problem
@ 2003-09-22 17:00 Adam Stein
  0 siblings, 0 replies; 6+ messages in thread
From: Adam Stein @ 2003-09-22 17:00 UTC (permalink / raw)
  To: gcc-help, joe_taylor

>I'm running Solaris 8 and gcc3.3 for some reason I can't get math.h
>calls to work. none of the trig functions work.  I have checked the path
>and it is ok. I have called the path out in the include statement. I
>have searched the machine for other math.h files there is one in the
>/usr/include dir and one in the gcc path.  I have tried both of them
>neither work.  Odd problem? Any ideas?

You ARE linking to the math library, right?

                                                Adam Stein
--
Adam Stein @ Xerox Corporation       Email: adam@scan.mc.xerox.com
                                            
Disclaimer: All views expressed             
here have been proved to be my own.  [http://www.csh.rit.edu/~adam/]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-09-22 17:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-13 15:28 math.h problem Anant Aneja
2003-01-13 16:09 ` Fabio Mazzone
2003-01-13 16:31   ` Andrea 'fwyzard' Bocci
2003-01-13 18:55     ` bjorn rohde jensen
2003-09-22 16:46 Joe Taylor
2003-09-22 17:00 Adam Stein

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 read-only IMAP folder(s) and NNTP newsgroup(s).