-1
#include <stdio.h>
#include <math.h>

int main()
{
    printf("%.81f\n", 1+2*sqrt(3)/(5-0.1));
    return 0;
}

output: /tmp/a4-4oU730.o: In function main': a4.c:(.text+0x4f): undefined reference tosqrt' clang: error: linker command failed with exit code 1 (use -v to see invocation)

sakuya.luo
  • 31
  • 1
  • 2
  • 4
    If you google the error message, several thousands of solutions come up. –  May 04 '13 at 03:44

1 Answers1

1

Try adding -lm for libm for math to your build command. That said, your code works fine for me using clang 4.1 on Mac OS.

John Zwinck
  • 239,568
  • 38
  • 324
  • 436