unable to compile C programs in linux

Asked by Edwin

i used gcc -o outputfile -program.c to compile my program but it says

 crc.c:2:20: fatal error: stdlib.h: No such file or directory
 #include< stdlib.h>
                    ^
compilation terminated.

it happens for every c and cpp program... need urgent help... i installed build essential up to date..

this is my program for crc error detection

#include< stdlib.h>
#include< conio.h>
#include< stdio.h>
void main()
{
int i,j,n,g,a,arr[20],gen[20],b[20],q[20],s;
clrscr();
printf("Transmitter side:");
printf("\nEnter no. of data bits:");
scanf("%d",&n);
printf("Enter data:");
for(i=0;i< n;i++)
scanf("%d",&arr[i]);

printf("Enter size of generator:");
scanf("%d",&g);
do{
printf("Enter generator:");
for(j=0;j< g;j++)
scanf("%d",&gen[j]);

}
while(gen[0]!=1);
printf("\n\tThe generator matrix:");
for(j=0;j< g;j++)
printf("%d",gen[j]);

a=n+(g-1);
printf("\n\tThe appended matrix is:");
for(i=0;i< j;++i)
arr[n+i]=0;

for(i=0;i< a;++i)

printf("%d",arr[i]);

for(i=0;i< n;++i)
q[i]= arr[i];

for(i=0;i< n;++i)
{
if(arr[i]==0)
{
for(j=i;j< g+i;++j)
arr[j] = arr[j]^0;
}
else
{
arr[i] = arr[i]^gen[0];
arr[i+1]=arr[i+1]^gen[1];
arr[i+2]=arr[i+2]^gen[2];
arr[i+3]=arr[i+3]^gen[3];
}
}
printf("\n\tThe CRC is :");
for(i=n;i < a;++i)
printf("%d",arr[i]);
s=n+a;
for(i=n;i< s;i++)
q[i]=arr[i];
printf("\n");
for(i=0;i< a;i++)
printf("%d",q[i]);
getch();
}

kindly help please !

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Did you install build-essential?

Revision history for this message
Edwin (hopkid2012) said :
#2

yes i did... still shows the same error

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Ahhh it's a typo issue

Change:

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

To:

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

Should be fine.

Revision history for this message
Edwin (hopkid2012) said :
#4

I changed and it still sayss fatal error #include <conio.h> no such file or directory

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#5

http://unix.stackexchange.com/questions/126842/conio-h-file-missing-error

conio.h seems to be just a Microsoft thing and isn't in Linux.

Revision history for this message
Edwin (hopkid2012) said :
#6

Thanks actionparsnip, that solved my question.