鱼C论坛

 找回密码
 立即注册
123
返回列表 发新帖
楼主: xg-sco

[已解决]fatal error: bits/c++config.h: No such file or directory

[复制链接]
 楼主| 发表于 2021-8-9 22:42:19 | 显示全部楼层
  1. [root@localhost chapter5]# g++ test2.cpp
  2. In file included from test2.cpp:1:0:
  3. /usr/include/c++/4.8.2/iostream:38:28: fatal error: bits/c++config.h: No such file or directory
  4. #include <bits/c++config.h>
  5.                             ^
  6. compilation terminated.
  7. [root@localhost chapter5]# file a.out
  8. a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=7ee0b059020fb47c71749930feab22cd4877bddf, not stripped
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 22:43:08 | 显示全部楼层
  1. g++ -I /usr/include/c++/4.8.2/i686-redhat-linux test2.cpp
  2. file a.out
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 22:45:40 | 显示全部楼层
  1. [root@localhost chapter5]# g++ -I /usr/include/c++/4.8.2/i686-redhat-linux test2.cpp
  2. [root@localhost chapter5]# file a.out
  3. a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=7ee0b059020fb47c71749930feab22cd4877bddf, not stripped
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 22:47:03 | 显示全部楼层
  1. ls -F /usr/include/c++/4.8.2/i686-redhat-linux
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 22:48:54 | 显示全部楼层
  1. [root@localhost chapter5]# ls -F /usr/include/c++/4.8.2/i686-redhat-linux
  2. bits/  ext/
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 22:51:16 | 显示全部楼层
  1. ls -F /usr/include/c++/4.8.2/i686-redhat-linux/ext/
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 22:52:39 | 显示全部楼层
  1. [root@localhost chapter5]# ls -F /usr/include/c++/4.8.2/i686-redhat-linux/ext/
  2. opt_random.h
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 23:03:09 | 显示全部楼层
  1. ls -F /usr/include/c++/4.8.5/x86_64-redhat-linux
  2. ls -F /usr/include/c++/4.8.5
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 23:04:34 | 显示全部楼层
  1. [root@localhost chapter5]# ls -F /usr/include/c++/4.8.5/x86_64-redhat-linux
  2. ls: cannot access /usr/include/c++/4.8.5/x86_64-redhat-linux: No such file or directory
  3. [root@localhost chapter5]# ls -F /usr/include/c++/4.8.5
  4. /usr/include/c++/4.8.5@
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 23:16:59 | 显示全部楼层
  1. 32
  2. ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux/32"

  3. 64
  4. ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux"

  5. 现在是 x86_64-redhat-linux 这个目录不存在,只有 i686-redhat-linux,而且这个目录是在 4.8.2 下面,当前的编译器版本是 4.8.5
  6. 而且这个 i686 是真的 i686,因为这里面没有 32 目录
  7. 我不知道为什么会发生这种情况,既然 4.8.5 下面没有这个目录,那就用 4.8.2 下面的 i686 版本吧
  8. 如果手动引用这个目录的话,32 位编译和 64 位编译都能过
  9. 那么,修复 4.8.5 下面的目录
  10. cp -r /usr/include/c++/4.8.2/i686-redhat-linux /usr/include/c++/4.8.5/x86_64-redhat-linux
  11. cd /usr/include/c++/4.8.5/x86_64-redhat-linux
  12. ls -s . 32

  13. cd
  14. g++ test2.cpp
  15. g++ -m32 test2.cpp
  16. g++ -m64 test2.cpp
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 23:23:22 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 23:26:56 | 显示全部楼层
  1. [root@localhost chapter5]# cp -r /usr/include/c++/4.8.2/i686-redhat-linux /usr/include/c++/4.8.5/x86_64-redhat-linux
  2. [root@localhost chapter5]# cd /usr/include/c++/4.8.5/x86_64-redhat-linux
  3. [root@localhost x86_64-redhat-linux]# ls -s . 32
  4. ls: cannot access 32: No such file or directory
  5. .:
  6. total 4
  7. 4 bits  0 ext
  8. [root@localhost chapter5]# g++ test2.cpp
  9. [root@localhost chapter5]# g++ -m32 test2.cpp
  10. In file included from test2.cpp:1:0:
  11. /usr/include/c++/4.8.2/iostream:38:28: fatal error: bits/c++config.h: No such file or directory
  12. #include <bits/c++config.h>
  13.                             ^
  14. compilation terminated.
  15. [root@localhost chapter5]# g++ -m64 test2.cpp
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 23:29:26 | 显示全部楼层

我不知道该说什么好,^_^
我居然把 ln 写成 ls
cd /usr/include/c++/4.8.5/x86_64-redhat-linux
ln -s .32
cd

g++ test2.cpp
g++ -m32 test2.cpp
g++ -m64 test2.cpp
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 23:32:50 | 显示全部楼层
  1. cd /usr/include/c++/4.8.5/x86_64-redhat-linux
  2. ln -s . 32

  3. cd
  4. g++ test2.cpp
  5. g++ -m32 test2.cpp
  6. g++ -m64 test2.cpp
复制代码

评分

参与人数 1荣誉 +5 鱼币 +5 贡献 +3 收起 理由
xg-sco + 5 + 5 + 3 鱼C有你更精彩^_^

查看全部评分

小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 23:34:54 | 显示全部楼层
人造人 发表于 2021-8-9 23:29
我不知道该说什么好,^_^
我居然把 ln 写成 ls
cd /usr/include/c++/4.8.5/x86_64-redhat-linux


好了,终于弄好了^_^
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 23:35:48 | 显示全部楼层
xg-sco 发表于 2021-8-9 23:34
好了,终于弄好了^_^

^_^
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-26 23:07

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表