centos查看哪些包提供指定標頭檔

來源:互聯網
上載者:User

標籤:

【問題】:項目遷移時,原來在suse上正常的代碼在centos上報錯:

g++ -g -Wall -fPIC -I../include -I./ -I../src -I/share/comm_ext -I/home/appadmin/workspace/comm/export_include/ -I/home/appadmin/workspace/comm/export_include/c2cplatform -I/home/appadmin/workspace/comm/export_include/app_platform -I/home/appadmin/workspace/comm/export_include/app_platform/2.4.1 -c ../include/myutil/net_util.cpp../include/myutil/net_util.cpp:5:21: 錯誤:stropts.h:沒有那個檔案或目錄

 

【尋找原因】

1. “stropts.h”似乎是系統提供的標頭檔,那麼位於哪個目錄下呢?

在suse上使用如下命令:

g++ -g -Wall -fPIC -I../include -I./ -I../src -I/share/comm_ext -I/home/appadmin/workspace/comm/export_include/ -I/home/appadmin/workspace/comm/export_include/c2cplatform -I/home/appadmin/workspace/comm/export_include/app_platform -I/home/appadmin/workspace/comm/export_include/app_platform/2.4.1 -E ../include/myutil/net_util.cpp >util.i

使用g++的 -E選項進行預先處理(關於-E選項的更多內容,請自行搜尋)

開啟util.i,有如下內容:

# 1 "/usr/include/stropts.h" 1 3 4

可知在suse上該檔案位於/usr/include/stropts.h

 

2. 再centos上查看,確實不存在/usr/include/stropts.h檔案:

find /usr -name *stropts.h*find: “/usr/lib64/audit”: 許可權不夠

也就是說,centos上的環境確實缺少該標頭檔

 

3.既然缺少那就安裝。首先需要知道的是,該標頭檔屬於哪個包?

$ yum provides */stropts.hLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile1:compat-glibc-headers-2.5-46.2.x86_64 : Header files for development using standard C libraries.Repo        : baseMatched from:Filename    : /usr/lib/x86_64-redhat-linux5E/include/stropts.hFilename    : /usr/lib/x86_64-redhat-linux5E/include/bits/stropts.hFilename    : /usr/lib/x86_64-redhat-linux5E/include/sys/stropts.h

可知compat-glibc-headers-2.5-46.2.x86_64包提供我們需要的標頭檔,我們只需要安裝該包就行了。

 

4.先確認一下該包有沒有被安裝過:

$ yum list|grep installedCollabNetSubversion-client.x86_64        1.8.10-2                          installedImageMagick.x86_64                       6-7                               installedcpp.x86_64                               4.1.2-55.el5                      installeddal_auto_script.i586                     1-3                               installeddal_auto_script_set.i586                 1-3                               installedgcc.x86_64                               4.1.2-55.el5                      installedgcc-c++.x86_64                           4.1.2-55.el5                      installedlibgcc.x86_64                            4.1.2-55.el5                      installedlibstdc++.x86_64                         4.1.2-55.el5                      installedlibstdc++-devel.x86_64                   4.1.2-55.el5                      installedperl_crontab.i586                        1-0                               installedpublic_scripts.i586                      1-8                               installedwget.x86_64                              1.12-1.8.el6                      installed

既然沒有,那就安裝吧。。。

 

centos查看哪些包提供指定標頭檔

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.