I see the error collect2: error: ld returned 1 exit status very often. For example, I was executing the following snippet of code:
void main() {
char i;
printf("ENTER i");
scanf("%c",&i);
clrscr();
switch(i) {
default:
printf("\nHi..\n");
break;
case 1:
printf("\n\na");
break;
case 2:
printf("\nb\n");
break;
case 3:
printf("\nc");
break;
}
}
and I got this:
main.c:(.text+0x33): undefined reference to `clrscr'
collect2: error: ld returned 1 exit status
What does it mean?
conio.hif you are using TurboC. If you are using GCC,this won't work even if you include it.Also,useint main()instead ofvoid main()and add areturn 0;at the end.Also the program would just printHi..and exit whatsoever be the input - Spikatrix