在编译文件时缺少头文件时应该怎么解决。

这位哥们在安赚Tokyo Cabinet时遇到头文件缺少的问题,讲得很清楚。链接如下:http://www.rosoo.net/a/201203/15797.html

在这里简单介绍一下:命令apt-file可以找到所缺少的头文件所在的包,方便我们直接安装使用。

1、先安装apt-file命令所依赖的包。

 ~#:aptitude install apt-file
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
The following NEW packages will be installed:
  apt-file libapt-pkg-perl{a} libconfig-file-perl{a} liblist-moreutils-perl{a}
0 packages upgraded, 4 newly installed, 0 to remove and 24 not upgraded.
Need to get 171kB of archives. After unpacking 565kB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Get:1 http://mirrors.163.com stable/main libconfig-file-perl 1.42-1 [11.7kB]
Get:2 http://mirrors.163.com stable/main libapt-pkg-perl 0.1.22+b1 [88.8kB]
Get:3 http://mirrors.163.com stable/main liblist-moreutils-perl 0.22-1+b1 [51.5kB]
Get:4 http://mirrors.163.com stable/main apt-file 2.1.5 [19.2kB]
Fetched 171kB in 1s (110kB/s)
Selecting previously deselected package libconfig-file-perl.
(Reading database ... 72133 files and directories currently installed.)
Unpacking libconfig-file-perl (from .../libconfig-file-perl_1.42-1_all.deb) ...
Selecting previously deselected package libapt-pkg-perl.
Unpacking libapt-pkg-perl (from .../libapt-pkg-perl_0.1.22+b1_i386.deb) ...
Selecting previously deselected package liblist-moreutils-perl.
Unpacking liblist-moreutils-perl (from .../liblist-moreutils-perl_0.22-1+b1_i386.deb) ...
Selecting previously deselected package apt-file.
Unpacking apt-file (from .../apt-file_2.1.5_all.deb) ...
Processing triggers for man-db ...
Setting up libconfig-file-perl (1.42-1) ...
Setting up libapt-pkg-perl (0.1.22+b1) ...
Setting up liblist-moreutils-perl (0.22-1+b1) ...
Setting up apt-file (2.1.5) ...
You need to run 'apt-file update' as root to update the cache.

Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Reading task descriptions... Done

2、用apt-file update 命令来更新cache。这里需要很长的一段时间,需要耐心等待。

3、现在我们可以尝试,apt-file的强大啦。

命令格式如下:apt-file find|search header.h(header.h为编译过程中提示缺少的头文件);

然后系统会自动显示缺少的包,以及该头文件应该放置的目录。建议安装系统默认的头文件包含路径所对应的包。

接下来就用apt-get install 命令安装该软件包。

4、现在头文件已经安装好啦,继续你的linux路程吧。

 

 

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值