鱼C论坛

 找回密码
 立即注册
查看: 6476|回复: 55

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

[复制链接]
发表于 2021-8-9 20:13:39 | 显示全部楼层 |阅读模式
50鱼币
test2.cpp代码
#include <iostream>
#include <algorithm>

using namespace std;
const int maxn = 100 + 10;
int A[maxn];

int main()
{
        long long a, b;
        while (cin >> a >> b)
        {
                cout << min(a, b) << "\n";
        }

        return 0;
}

我想在linux编译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.
这个错误

QQ图片20210809200512.png

代码全部复制下来到devcpp却可以编译运行

不知道怎么解决这个问题
最佳答案
2021-8-9 20:13:40

还真有这个文件
g++ -I /usr/include/c++/4.8.2/i686-redhat-linux test2.cpp

最佳答案

查看完整内容

还真有这个文件
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:13:40 | 显示全部楼层    本楼为最佳答案   

还真有这个文件
g++ -I /usr/include/c++/4.8.2/i686-redhat-linux test2.cpp
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 20:14:26 | 显示全部楼层
在别的网站上找到的办法是输入
sudo apt-get install gcc-multilib g++-multilib
sudo apt-get install gcc-4.8-multilib g++-4.8-multilib
得到的结果是sudo: apt-get: command not found
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:17:55 | 显示全部楼层
xg-sco 发表于 2021-8-9 20:14
在别的网站上找到的办法是输入

先进入特权模式再
install gcc-4.8-multilib g++-4.8-multilib
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 20:34:46 | 显示全部楼层
大马强 发表于 2021-8-9 20:17
先进入特权模式再
install gcc-4.8-multilib g++-4.8-multilib

我这已经是特权模式了,但是gcc-4.8-multilib g++-4.8-multilib要怎么安装

输入
install gcc-4.8-multilib g++-4.8-multilib
得到
install: cannot stat ‘gcc-4.8-multilib’: No such file or directory

加个yum也安装不成功
yum install gcc-4.8-multilib g++-4.8-multilib
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
No package gcc-4.8-multilib available.
No package g++-4.8-multilib available.
Error: Nothing to do
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:37:12 | 显示全部楼层
xg-sco 发表于 2021-8-9 20:34
我这已经是特权模式了,但是gcc-4.8-multilib g++-4.8-multilib要怎么安装

输入

知识盲区,蹲大佬吧
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:40:41 | 显示全部楼层
ls /
ls /usr/include/c++
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 20:42:16 | 显示全部楼层
[root@localhost chapter5]# ls /
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[root@localhost chapter5]# ls /usr/include/c++
4.8.2  4.8.5
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

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

使用道具 举报

 楼主| 发表于 2021-8-9 20:44:57 | 显示全部楼层
[root@localhost chapter5]# g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

这是我g++没有安装好来吗?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:46:03 | 显示全部楼层
ls /usr/include/c++/4.8.2/bits/c++config.h
ls /usr/include/c++/4.8.5/bits/c++config.h
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:47:41 | 显示全部楼层
g++ -v test2.cpp
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

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

使用道具 举报

发表于 2021-8-9 20:49:33 | 显示全部楼层
ls /usr/include/c++/4.8.2/bits/
ls /usr/include/c++/4.8.5/bits/
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 20:52:11 | 显示全部楼层
[root@localhost bits]# ls /usr/include/c++/4.8.2/bits/
algorithmfwd.h             hash_bytes.h             regex_constants.h          stl_numeric.h
allocator.h                hashtable.h              regex_cursor.h             stl_pair.h
alloc_traits.h             hashtable_policy.h       regex_error.h              stl_queue.h
atomic_base.h              indirect_array.h         regex_grep_matcher.h       stl_raw_storage_iter.h
atomic_lockfree_defines.h  ios_base.h               regex_grep_matcher.tcc     stl_relops.h
basic_ios.h                istream.tcc              regex.h                    stl_set.h
basic_ios.tcc              list.tcc                 regex_nfa.h                stl_stack.h
basic_string.h             locale_classes.h         regex_nfa.tcc              stl_tempbuf.h
basic_string.tcc           locale_classes.tcc       shared_ptr_base.h          stl_tree.h
boost_concept_check.h      locale_facets.h          shared_ptr.h               stl_uninitialized.h
c++0x_warning.h            locale_facets_nonio.h    slice_array.h              stl_vector.h
char_traits.h              locale_facets_nonio.tcc  sstream.tcc                streambuf_iterator.h
codecvt.h                  locale_facets.tcc        stl_algobase.h             streambuf.tcc
concept_check.h            localefwd.h              stl_algo.h                 stream_iterator.h
cpp_type_traits.h          mask_array.h             stl_bvector.h              stringfwd.h
cxxabi_forced.h            memoryfwd.h              stl_construct.h            unique_ptr.h
deque.tcc                  move.h                   stl_deque.h                unordered_map.h
exception_defines.h        nested_exception.h       stl_function.h             unordered_set.h
exception_ptr.h            ostream_insert.h         stl_heap.h                 uses_allocator.h
forward_list.h             ostream.tcc              stl_iterator_base_funcs.h  valarray_after.h
forward_list.tcc           postypes.h               stl_iterator_base_types.h  valarray_array.h
fstream.tcc                ptr_traits.h             stl_iterator.h             valarray_array.tcc
functexcept.h              random.h                 stl_list.h                 valarray_before.h
functional_hash.h          random.tcc               stl_map.h                  vector.tcc
gslice_array.h             range_access.h           stl_multimap.h
gslice.h                   regex_compiler.h         stl_multiset.h
[root@localhost bits]# ls /usr/include/c++/4.8.5/bits/
algorithmfwd.h             hash_bytes.h             regex_constants.h          stl_numeric.h
allocator.h                hashtable.h              regex_cursor.h             stl_pair.h
alloc_traits.h             hashtable_policy.h       regex_error.h              stl_queue.h
atomic_base.h              indirect_array.h         regex_grep_matcher.h       stl_raw_storage_iter.h
atomic_lockfree_defines.h  ios_base.h               regex_grep_matcher.tcc     stl_relops.h
basic_ios.h                istream.tcc              regex.h                    stl_set.h
basic_ios.tcc              list.tcc                 regex_nfa.h                stl_stack.h
basic_string.h             locale_classes.h         regex_nfa.tcc              stl_tempbuf.h
basic_string.tcc           locale_classes.tcc       shared_ptr_base.h          stl_tree.h
boost_concept_check.h      locale_facets.h          shared_ptr.h               stl_uninitialized.h
c++0x_warning.h            locale_facets_nonio.h    slice_array.h              stl_vector.h
char_traits.h              locale_facets_nonio.tcc  sstream.tcc                streambuf_iterator.h
codecvt.h                  locale_facets.tcc        stl_algobase.h             streambuf.tcc
concept_check.h            localefwd.h              stl_algo.h                 stream_iterator.h
cpp_type_traits.h          mask_array.h             stl_bvector.h              stringfwd.h
cxxabi_forced.h            memoryfwd.h              stl_construct.h            unique_ptr.h
deque.tcc                  move.h                   stl_deque.h                unordered_map.h
exception_defines.h        nested_exception.h       stl_function.h             unordered_set.h
exception_ptr.h            ostream_insert.h         stl_heap.h                 uses_allocator.h
forward_list.h             ostream.tcc              stl_iterator_base_funcs.h  valarray_after.h
forward_list.tcc           postypes.h               stl_iterator_base_types.h  valarray_array.h
fstream.tcc                ptr_traits.h             stl_iterator.h             valarray_array.tcc
functexcept.h              random.h                 stl_list.h                 valarray_before.h
functional_hash.h          random.tcc               stl_map.h                  vector.tcc
gslice_array.h             range_access.h           stl_multimap.h
gslice.h                   regex_compiler.h         stl_multiset.h
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:52:59 | 显示全部楼层
g++ -v test2.cpp
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

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

使用道具 举报

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

使用道具 举报

 楼主| 发表于 2021-8-9 20:57:04 | 显示全部楼层
[root@localhost chapter5]# yum list | grep gcc
gcc.x86_64                                  4.8.5-44.el7               @base    
gcc-c++.x86_64                              4.8.5-44.el7               @base    
libgcc.i686                                 4.8.5-44.el7               @base    
libgcc.x86_64                               4.8.5-44.el7               @anaconda
compat-gcc-44.x86_64                        4.4.7-8.el7                base     
compat-gcc-44-c++.x86_64                    4.4.7-8.el7                base     
compat-gcc-44-gfortran.x86_64               4.4.7-8.el7                base     
gcc-gfortran.x86_64                         4.8.5-44.el7               base     
gcc-gnat.x86_64                             4.8.5-44.el7               base     
gcc-go.x86_64                               4.8.5-44.el7               base     
gcc-objc.x86_64                             4.8.5-44.el7               base     
gcc-objc++.x86_64                           4.8.5-44.el7               base     
gcc-plugin-devel.x86_64                     4.8.5-44.el7               base     
relaxngcc.noarch                            1.12-6.el7                 base     
relaxngcc-javadoc.noarch                    1.12-6.el7                 base     
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 21:02:49 | 显示全部楼层
yum search build-essential
yum search gcc
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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