История изменений
Исправление fornlr, (текущая версия) :
pony cat pony.c
#include <stdio.h>
#include <math.h>
int main(void)
{
int i;
for (i = 0; i < 64; i++)
{
printf("%f\n", sin(i + 1));
}
return 0;
}
➜ pony cat pony.cpp
#include <iostream>
#include <math.h>
int main(void)
{
int i;
for (i = 0; i < 64; i++)
{
std::cout << sin(i + 1) << std::endl;
}
return 0;
}
➜ pony gcc pony.c
/tmp/cc6V89tE.o: In function `main':
pony.c:(.text+0x20): undefined reference to `sin'
collect2: error: ld returned 1 exit status
➜ pony g++ pony.cpp
➜ pony
В СИшном около всегда надо было линковать math
Исходная версия fornlr, :
pony cat pony.c
#include <stdio.h>
#include <math.h>
int main(void)
{
int i;
for (i = 0; i < 64; i++)
{
printf("%f\n", sin(i + 1));
}
return 0;
}
➜ pony cat pony.cpp
#include <iostream>
#include <math.h>
int main(void)
{
int i;
for (i = 0; i < 64; i++)
{
std::cout << sin(i + 1) << std::endl;
}
return 0;
}
➜ pony gcc pony.c
/tmp/cc6V89tE.o: In function `main':
pony.c:(.text+0x20): undefined reference to `sin'
collect2: error: ld returned 1 exit status
➜ pony g++ pony.cpp
➜ pony