无法在Linux Mint 15中编译简单的c程序 [英] Unable to compile simple c program in Linux Mint 15

查看:294
本文介绍了无法在Linux Mint 15中编译简单的c程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Linux Mint 15用户。

i想在C中编写简单的程序。

下面是我的代码(hw.c)

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

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

但是,当我尝试使用gcc

But, when i try to compile it with gcc

gcc -o hw hw.c


$ b b

它给我一个错误

it gives me an error

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

我googled并发现一些解决方案,说要安装 build-essential

并尝试安装它

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

sudo apt-get install build-essintial

但它再次出错。
错误是

but it gives an error again. The error is

    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.

那么什么错了?有什么问题?

如何解决?

PS。
找到stdio.h 的结果是

/usr/lib/perl/5.14.2/CORE/nostdio.h
/usr/lib/syslinux/com32/include/stdio.h


推荐答案

我有同样的问题,只是安装了g ++包,并修复了缺少的包含文件。

I was having the same problem, and simply installed the g++ package and that fixed the missing include file.

sudo apt-get install g ++

这篇关于无法在Linux Mint 15中编译简单的c程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆