public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: tobias_meier@my-deja.com
To: help-gcc@gnu.org
Subject: Problems with math.h
Date: Sat, 01 Apr 2000 00:00:00 -0000	[thread overview]
Message-ID: <85483i$a32$1@nnrp1.deja.com> (raw)
Message-ID: <20000401000000.BTcZIf6gcjvMIo4g28fI1h2-4dTmK_qj9wvdO0_eU1U@z> (raw)

Hi all,

compiling this program with the command:

gcc MatheTest.c

/* Program MatheTest.c*/
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <math.h>

main()
{
printf("Ergebnis %f \n", exp(2.3));
printf("Ergebnis %f \n", pow(2,3));
}

/* End Program */

I get:

cd /home/tmeier/C/Projekt01/
gcc MatheTest.c
/tmp/ccdP8Uys.o: In function `main':
/tmp/ccdP8Uys.o(.text+0xe): undefined reference to `exp'
/tmp/ccdP8Uys.o(.text+0x37): undefined reference to `pow'
collect2: ld returned 1 exit status

Compilation exited abnormally with code 1 at Thu Jan  6 22:27:58


 -> problems with math.h

looking up search dirs with command:

gcc -print-search-dirs

I get:

install: /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/
programs: /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/:/usr/lib/gcc-
lib/i486-linux/:/usr/lib/gcc/i486-linux/egcs-2.91.60/:/usr/lib/gcc/i486-
linux/:/usr/i486-linux/bin/i486-linux/egcs-2.91.60/:/usr/i486-linux/bin/
libraries: /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/:/usr/lib/gcc/i486-
linux/egcs-2.91.60/:/usr/i486-linux/lib/i486-linux/egcs-
2.91.60/:/usr/i486-linux/lib/:/usr/lib/i486-linux/egcs-
2.91.60/:/usr/lib/:/lib/i486-linux/egcs-2.91.60/:/lib/:/usr/lib/i486-
linux/egcs-2.91.60/:/usr/lib/

searching math.h I get:
/usr/include/math.h

Ok, using option -B for gcc:

gcc -B /usr/include/math.h MatheTest.c

I get:

cd /home/tmeier/C/Projekt01/
gcc -B /usr/include/math.h MatheTest.c
/tmp/ccOFzmvH.o: In function `main':
/tmp/ccOFzmvH.o(.text+0xe): undefined reference to `exp'
/tmp/ccOFzmvH.o(.text+0x37): undefined reference to `pow'
collect2: ld returned 1 exit status
gcc: file path prefix `/usr/include/math.h' never used

Compilation exited abnormally with code 1 at Thu Jan  6 22:41:52

Compiling with g++ works:

But g++ has the same search path as gcc has !

g++ serch dirs (g++ -print-search-dirs)
install: /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/
programs: /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/:/usr/lib/gcc-
lib/i486-linux/:/usr/lib/gcc/i486-linux/egcs-2.91.60/:/usr/lib/gcc/i486-
linux/:/usr/i486-linux/bin/i486-linux/egcs-2.91.60/:/usr/i486-linux/bin/
libraries: /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/:/usr/lib/gcc/i486-
linux/egcs-2.91.60/:/usr/i486-linux/lib/i486-linux/egcs-
2.91.60/:/usr/i486-linux/lib/:/usr/lib/i486-linux/egcs-
2.91.60/:/usr/lib/:/lib/i486-linux/egcs-2.91.60/:/lib/:/usr/lib/i486-
linux/egcs-2.91.60/:/usr/lib/


Who knows what to do ?


Sent via Deja.com http://www.deja.com/
Before you buy.

             reply	other threads:[~2000-04-01  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-07  0:46 tobias_meier [this message]
2000-01-07  0:51 ` Alexandre Oliva
2000-04-01  0:00   ` Alexandre Oliva
2000-01-07  1:22 ` Eric Meijer
2000-04-01  0:00   ` Eric Meijer
2000-01-07  3:01 ` Zoran Cutura
2000-04-01  0:00   ` Zoran Cutura
2000-04-01  0:00 ` tobias_meier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='85483i$a32$1@nnrp1.deja.com' \
    --to=tobias_meier@my-deja.com \
    --cc=help-gcc@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).