LINUX.ORG.RU

История изменений

Исправление reprimand, (текущая версия) :

#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
	float a = 1;
	printf("%f\n", sin(a));
	return EXIT_SUCCESS;
}


$ c99 lmtest.c -o lmtest
/tmp/ccGwtzj7.o: In function `main':
lmtest.c:(.text+0x1e): undefined reference to `sin'
collect2: error: ld returned 1 exit status


#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
	printf("%f\n", sin(5));
	return EXIT_SUCCESS;
}

$ c99 lmtest.c -o lmtest
$ ./lmtest 
-0.958924

Исходная версия reprimand, :

#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
	float a = 1;
	printf("%f\n", sin(a));
	return EXIT_SUCCESS;
}


$ c99 lmtest.c -o lmtest
/tmp/ccGwtzj7.o: In function `main':
lmtest.c:(.text+0x1e): undefined reference to `sin'
collect2: error: ld returned 1 exit status


#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
	printf("%f\n", sin(5));
	return EXIT_SUCCESS;
}

$ c99 lmtest.c -o lmtest
$ ./lmtest 
-0.958924