ld returned 1 exit status
when I tried to compile, an error occured.
# gcc -o prog21_1 prog21_1.c
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
what does it means ...???
Re: ld returned 1 exit status
Forgot to add 'main' function in the program ie. int main ( blah..blah)? If you get error again and you are trying to compile c++, try using g++ instead of gcc.
Re: ld returned 1 exit status
Haitalk
As you pointed out, I didn't use 'main' function...
First time, I wrote as follow.
-----------------------------------------
int sub_proc(int a, int b, int c)
{
int buf[5];
buf[0]=a;
buf[1]=b;
buf[2]=c;
return(2);
}
int testproc()
{
sub_proc(1,2,3);
return(1);
}
------------------------------------------
This code is just for studying assembler code about 'preserve rocal buffer', 'function call', etc..
And I rewrote it as your advice.
-----------------------------------------
int sub_proc(int a, int b, int c)
{
int buf[5];
buf[0]=a;
buf[1]=b;
buf[2]=c;
return(2);
}
int testproc()
{
sub_proc(1,2,3);
return(1);
}
main()
{
testproc();
return 0;
}
------------------------------------------
I could compile and disassemble !!
Thank you so much !!