Re: gcc vs g++
On Tue, May 05, 2009 at 02:01:36PM +0400, Vasil'ev Michail wrote:
> -->gcc -o test test.c
> /tmp/cc41kOdl.o: In function `main':
> test.c:(.text+0x21): undefined reference to `ceil'
> collect2: ld returned 1 exit status
NAME
ceil, ceilf, ceill - ceiling function: smallest integral value not less
than argument
SYNOPSIS
#include <math.h>
double ceil(double x);
float ceilf(float x);
long double ceill(long double x);
Link with -lm.
^^^^^^^^^^^^^
> Почему этот код не компилируется? При этом
> g++ -o test test.c
> работает нормально.
g++ подключает libm самостоятельно вместе со своим C++-рантаймом.
--
Andrey V. Kiselev
Reply to:
- References:
- gcc vs g++
- From: Vasil'ev Michail <dlia-spama@mail.ru>