【发布时间】:2013-10-30 06:28:20
【问题描述】:
我是 Linux Mint 15 用户。
我想用 C 编写简单的程序。
下面是我的代码。(hw.c)
#include<stdio.h>
#include<conio.h>
int main()
{
printf("Hello World");
}
但是,当我尝试用 gcc 编译它时
gcc -o hw hw.c
它给了我一个错误
hw.c:1:18: fatal error: stdio.h: No such file or directory
compilation terminated.
我在谷歌上搜索并找到了一些安装build-essential的解决方案
并尝试安装它
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
【问题讨论】:
-
尝试
sudo aptitude update然后sudo aptitude upgrade然后sudo aptitude install libc-dev g++ build-essential。请注意,<conio.h>是 Windows 特定的标头,它不会在 Linux 上退出。并编译为gcc -Wall -g hw.c -o hw -
conio.h不是标准库中的标准.h文件。POSIX中没有定义 -
好的。我试图做 sudo aptitude install libc-dev g++ build-essential。但它说:不会安装、升级或删除任何包。 0 个软件包已升级,0 个新安装,0 个要删除,0 个未升级。需要获取 0 B 的档案。解包后将使用 0 B。但是问题并没有解决......
-
您的问题是系统管理员问题。你跑了
aptitude update和upgrade。请先修复您的系统。 -
是的,我当然做了 aptitude 更新和升级
标签: linux gcc compiler-errors linux-mint