关闭

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

1846人阅读 评论(0) 收藏 举报

这位哥们在安赚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
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:21258次
    • 积分:239
    • 等级:
    • 排名:千里之外
    • 原创:1篇
    • 转载:13篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档