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

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

问题描述

我是 Linux Mint 15 用户.
我想用 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

它给了我一个错误

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

我用谷歌搜索并找到了一些解决方案,上面写着要安装 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

但是又报错了.错误是

    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.

怎么了?有什么问题?
如何解决?

附注.locate 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天全站免登陆