I wrote this snippet to try some simple math but it appears I am the simple one:
Code:
// Test for math.h
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main(void)
{
double E;
double M;
double V;
M = .25;
V = 1400;
E = M*(pow(V,2))/2;
printf("Kinetic energy is %f", E);
getchar();
return(0);
}
Code:
/*
compiler error:
gcc -Wall -o "mathtest" "mathtest.c" (in directory: /home/paul/Documents/C-files)
/tmp/ccEbPuLK.o: In function `main':
mathtest.c:(.text+0x45): undefined reference to `pow'
collect2: error: ld returned 1 exit status
Compilation failed.
*/
I thought pow() was defined in math.h
I am using Ubuntu 14.04.1, coding in C99, using Geany IDE.
Am I ignorant? Am I missing the Math header file?
Paul