Hello,
I have to compile a program using cc, as and ld.
Here is the program :
Code:
#include <stdio.h>
long int factorielle(int n) {
if (n<2)
return 1;
else
return n*factorielle(n-1);
}
int main(int argc, char *argv[]){
int i;
printf("Hello World!\n\n");
for(i=0;i<10;i++)
printf("%i! = %li\n",i,factorielle(i));
return 0;
}
I use the folowing commands :
Code:
cc -c -S toto.c
as -o toto.o toto.s
No problem at this point, but the use of ld become complicated. I succeded using it like that:
Code:
ld -o toto /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtn.o /usr/lib/libc.so toto.o
No errors appears but it's impossible to execute the resulting program toto (of course I made a chmod).
I absolutely need to use cc, as and ld : can someone help me ?
Thanks for all...