I was using my college’s unix server (ubuntu presumably) to compile programs in the laboratory. Now, i have installed Opensuse 11.4 with gnome3. I have installed the Developers pattern, and almost all the packages that looked relevant (which came up when i searched for libgc , gcc, and all). Now, i cant compile a program:
/*program to test file I/O and getch/putch functionaliny in gcc*/
#include<stdio.h>
int main()
{ FILE *fi;
char ch;
char in;
fi = fopen("infile","r");
int countr=0,counterr=0;
in='0';
while(in!='
')
{
ch=fgetc(fi);
if(ch=='
')
continue;
else
{
in=getch();
if(in==ch)
{
putch(in);
countr++;
counterr--;
}
else
{
counterr++;
continue;
}
}
}
I am a beginner in programming, so any free advice is also welcome.
Oh, the error is:
siddhartha@suse:~/Documents/programs> gcc typeprac.c
/tmp/ccQHPVwJ.o: In function `main':
typeprac.c:(.text+0x50): undefined reference to `getch'
typeprac.c:(.text+0x6c): undefined reference to `putch'
collect2: ld returned 1 exit status
Thank you.