Вот вернулся к изучению Си, да возникают проблемы( Почему не компилируется программа?
#include <stdio.h>
#include <math.h>
int main(void){
int i = 169, j = 168;
printf(
"sqrt(%d)=%d, sqrt(%d)=%d",
i, (int)sqrt((double)i),
j, (int)sqrt((double)j)
);
return 0;
}
лог:
Код
compiler@hope:~/helloworld$ gcc a.c
/tmp/ccEdG7FC.o: In function `main':
a.c:(.text+0x41): undefined reference to `sqrt'
a.c:(.text+0x6b): undefined reference to `sqrt'
collect2: выполнение ld завершилось с кодом возврата 1
/tmp/ccEdG7FC.o: In function `main':
a.c:(.text+0x41): undefined reference to `sqrt'
a.c:(.text+0x6b): undefined reference to `sqrt'
collect2: выполнение ld завершилось с кодом возврата 1
компилятор: gcc (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
заранее благодарен.
Сообщение отредактировано: compiler -