gcc exp & math.h [LÖST]
Postat: 13 maj 2007, 22:19
om jag vill använda exp-funktionen i math.h med gcc, hur gör jag då? om jag kompilerar med g++ funkar det utan problem men med gcc så klagar kompilatorn:
gcc -o testexp testexp.c/tmp/ccmXm2Ae.o: In function `main':
testexp.c:(.text+0x23): undefined reference to `exp'
collect2: ld returnerade avslutningsstatus 1
några tips?
(sitter egentligen med ett större c-projekt, där jag redan har fått funktioner som bara lyckas kompilera med gcc... )
tack på förhand
test programmet:
#include <math.h>
#include <stdio.h>
main()
{
double s=0.23;
printf("%f \n", exp(-s));
}
gcc -o testexp testexp.c/tmp/ccmXm2Ae.o: In function `main':
testexp.c:(.text+0x23): undefined reference to `exp'
collect2: ld returnerade avslutningsstatus 1
några tips?
(sitter egentligen med ett större c-projekt, där jag redan har fått funktioner som bara lyckas kompilera med gcc... )
tack på förhand
test programmet:
#include <math.h>
#include <stdio.h>
main()
{
double s=0.23;
printf("%f \n", exp(-s));
}