鱼C论坛

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

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

[复制链接]
 楼主| 发表于 2021-8-9 22:42:19 | 显示全部楼层
[root@localhost chapter5]# g++ test2.cpp 
In file included from test2.cpp:1:0:
/usr/include/c++/4.8.2/iostream:38:28: fatal error: bits/c++config.h: No such file or directory
 #include <bits/c++config.h>
                            ^
compilation terminated.
[root@localhost chapter5]# file a.out
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
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 22:43:08 | 显示全部楼层
g++ -I /usr/include/c++/4.8.2/i686-redhat-linux test2.cpp
file a.out
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 22:45:40 | 显示全部楼层
[root@localhost chapter5]# g++ -I /usr/include/c++/4.8.2/i686-redhat-linux test2.cpp
[root@localhost chapter5]# file a.out
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
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 22:47:03 | 显示全部楼层
ls -F /usr/include/c++/4.8.2/i686-redhat-linux
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 22:48:54 | 显示全部楼层
[root@localhost chapter5]# ls -F /usr/include/c++/4.8.2/i686-redhat-linux
bits/  ext/
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 22:51:16 | 显示全部楼层
ls -F /usr/include/c++/4.8.2/i686-redhat-linux/ext/
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 22:52:39 | 显示全部楼层
[root@localhost chapter5]# ls -F /usr/include/c++/4.8.2/i686-redhat-linux/ext/
opt_random.h
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 23:03:09 | 显示全部楼层
ls -F /usr/include/c++/4.8.5/x86_64-redhat-linux
ls -F /usr/include/c++/4.8.5
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 23:04:34 | 显示全部楼层
[root@localhost chapter5]# ls -F /usr/include/c++/4.8.5/x86_64-redhat-linux
ls: cannot access /usr/include/c++/4.8.5/x86_64-redhat-linux: No such file or directory
[root@localhost chapter5]# ls -F /usr/include/c++/4.8.5
/usr/include/c++/4.8.5@
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

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

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

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

cd
g++ test2.cpp
g++ -m32 test2.cpp
g++ -m64 test2.cpp
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 23:23:22 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 23:26:56 | 显示全部楼层
[root@localhost chapter5]# cp -r /usr/include/c++/4.8.2/i686-redhat-linux /usr/include/c++/4.8.5/x86_64-redhat-linux
[root@localhost chapter5]# cd /usr/include/c++/4.8.5/x86_64-redhat-linux
[root@localhost x86_64-redhat-linux]# ls -s . 32
ls: cannot access 32: No such file or directory
.:
total 4
4 bits  0 ext
[root@localhost chapter5]# g++ test2.cpp 
[root@localhost chapter5]# g++ -m32 test2.cpp 
In file included from test2.cpp:1:0:
/usr/include/c++/4.8.2/iostream:38:28: fatal error: bits/c++config.h: No such file or directory
 #include <bits/c++config.h>
                            ^
compilation terminated.
[root@localhost chapter5]# g++ -m64 test2.cpp 
想知道小甲鱼最近在做啥?请访问 -> 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
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 23:32:50 | 显示全部楼层
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

评分

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

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> 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


好了,终于弄好了^_^
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

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

^_^
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-21 22:45

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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