john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

gcc power undefined reference to pow

/* inputfile.c is a very simple example of power */
#include <stdio.h>
#include <math.h>

int main( int argc , char* argv[] )
{
  double i=2 , k=3 ;
  printf( " %f  \n " ,  pow( i , k ) );
  return 0;

}/* end main */

HERE'S THE SECRET FOR GCC, YOU NEED TO LINK TO THE MATH LIBRARY WITH "-lm"

gcc -o test.exe inputfile.c -lm

  • « rsa encryption in c continued
  • Ubuntu 11 qemu tinycore cherokee »

Published

Aug 15, 2011

Category

c

~51 words

Tags

  • c 95
  • gcc 9
  • math library 1
  • pow 1
  • power 2