Unable to compile simple C program.

Forum rules
Before you post please read this

Unable to compile simple C program.

Postby birinci2012 on Mon Oct 21, 2013 12:50 pm

Hi everybody.
I am a Linux Mint KDE 15 User.
i wanted to write simple program in C.
Below is my code.(hw.c)

Code: Select all
#include<stdio.h>
    #include<conio.h>
    int main()
    {
        printf("Hello World");
    }

But, when i try to compile it with gcc

Code: Select all
gcc -o hw hw.c

it gives me an error

Code: Select all
hw.c:1:18: fatal error: stdio.h: No such file or directory
    compilation terminated.

I googled and found some solutions which say to install `build-essential`
and tried to install it

Code: Select all
sudo apt-get install build-essintial

but it gives an error again.
The error is

Code: Select all
Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
   
    The following packages have unmet dependencies:
     build-essential : Depends: libc6-dev but it is not going to be installed or
                                libc-dev
                       Depends: g++ (>= 4:4.4.3) but it is not going to be installed
                       Depends: dpkg-dev (>= 1.13.5) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.


So what is wrong? What is the problem?
How to solve it?


PS.
The result of
Code: Select all
locate stdio.h
is

Code: Select all
 /usr/lib/perl/5.14.2/CORE/nostdio.h
    /usr/lib/syslinux/com32/include/stdio.h
birinci2012
Level 1
Level 1
 
Posts: 1
Joined: Thu Apr 04, 2013 1:43 am

Linux Mint is funded by ads and donations.
 

Re: Unable to compile simple C program.

Postby riyas yash on Sat Apr 05, 2014 11:01 am

install CLANG from software manager.
problem solved
riyas yash
Level 1
Level 1
 
Posts: 1
Joined: Sat Apr 05, 2014 10:53 am


Return to KDE

Who is online

Users browsing this forum: No registered users and 4 guests