Article View: gnu.gcc.help
Article #288??gcc with ansi and math lib??
From: Olaf Maennig
Date: Wed, 19 Aug 1992 11:05
Date: Wed, 19 Aug 1992 11:05
61 lines
3016 bytes
3016 bytes
Hi, folks.
I'm fairly new to C compilers on Sun, so please no flames to my question. :-)
I've problems with gcc -ansi. When including math.h from my program vector.c,
the following happens:
> make
/usr/local/gcc-2.2.2/bin/gcc -g -Wall -ansi -c vector.c
In file included from /usr/include/math.h:45, from vector.c:18:
/usr/include/floatingpoint.h:101: field `rd' has incomplete type
In file included from vector.c:18:
/usr/include/math.h:197: parse error before `r_acos_'
/usr/include/math.h:197: warning: data definition has no type or storage class
/usr/include/math.h:198: parse error before `r_acosh_'
/usr/include/math.h:198: warning: data definition has no type or storage class
/usr/include/math.h:199: parse error before `r_acospi_'
/usr/include/math.h:199: warning: data definition has no type or storage class
.
.
.
/usr/include/math.h:259: parse error before `r_y1_'
/usr/include/math.h:259: warning: data definition has no type or storage class
/usr/include/math.h:260: parse error before `r_yn_'
/usr/include/math.h:260: warning: data definition has no type or storage class
*** Error code 1
make: Fatal error: Command failed for target `vector.o'
This happens with both versions 1.40 and 2.2.2 of gcc.
When leaving '-ansi' away, it works as follows:
> make
/usr/local/gcc-2.2.2/bin/gcc -g -Wall -c vector.c
/usr/local/gcc-2.2.2/bin/gcc -g -Wall -c main.c
/usr/local/gcc-2.2.2/bin/gcc -g -Wall -lm -lc -o prg vector.o main.o
ld: Undefined symbol
_sqrt
collect: /usr/bin/ld returned 2 exit status
*** Error code 1
make: Fatal error: Command failed for target `prg'
What is going wrong? I don't achieve to get it working.
Why does '-ansi' behave so that I cannot include math.h anymore?
And why isn't it possible to use 'sqrt', although I have told to link the
math library?
At my site, I cannot ask anyone, because they are all using 'cc'. Maybe I
should have used that one, too :(, but I wanted to have ansi support.
And now it's not working???
Fast help appreciated, because I have to work on my tool...
Thanx.
--
---------------------------------------------------------------------------
_ Department of Computer Science IV
/ \ |\/| University of Dortmund, Germany
\_/laf | |aennig e-mail: maennig@siggi.informatik.uni-dortmund.de
---------------------------------------------------------------------------
Technical Details
Message-ID:
<16t9tvINN7se@fbi-news.Informatik.Uni-Dortmund.DE>Path:
arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!ucsbcsl!network.ucsd.edu!sdd.hp.com!cs.utexas.edu!sun-barr!decwrl!deccrl!bloom-beacon!eru.mt.luth.se!lunic!sunic!mcsun!Germany.EU.net!Informatik.Uni-Dortmund.DE!fred!maennigShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!ucsbcsl!network.ucsd.edu!sdd.hp.com!cs.utexas.edu!sun-barr!decwrl!deccrl!bloom-beacon!eru.mt.luth.se!lunic!sunic!mcsun!Germany.EU.net!Informatik.Uni-Dortmund.DE!fred!maennig From: maennig@fred.informatik.uni-dortmund.de (Olaf Maennig) Newsgroups: gnu.gcc.help Subject: ??gcc with ansi and math lib?? Message-ID: <16t9tvINN7se@fbi-news.Informatik.Uni-Dortmund.DE> Date: 19 Aug 92 11:05:35 GMT Sender: maennig@fred (Olaf Maennig) Organization: CS Department, Dortmund University, Germany Lines: 61 NNTP-Posting-Host: fred