鱼C论坛

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

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

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

  3. using namespace std;
  4. const int maxn = 100 + 10;
  5. int A[maxn];

  6. int main()
  7. {
  8.         long long a, b;
  9.         while (cin >> a >> b)
  10.         {
  11.                 cout << min(a, b) << "\n";
  12.         }

  13.         return 0;
  14. }
复制代码


我想在linux编译test2.cpp这个文件,但是会出现

  1. In file included from test2.cpp:1:0:
  2. /usr/include/c++/4.8.2/iostream:38:28: fatal error: bits/c++config.h: No such file or directory
  3. #include <bits/c++config.h>
  4.                             ^
  5. compilation terminated.
复制代码

这个错误

QQ图片20210809200512.png

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

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

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

最佳答案

查看完整内容

还真有这个文件
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

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

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

使用道具 举报

 楼主| 发表于 2021-8-9 20:14:26 | 显示全部楼层
在别的网站上找到的办法是输入
  1. sudo apt-get install gcc-multilib g++-multilib
复制代码
  1. sudo apt-get install gcc-4.8-multilib g++-4.8-multilib
复制代码

得到的结果是sudo: apt-get: command not found
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

先进入特权模式再
install gcc-4.8-multilib g++-4.8-multilib
小甲鱼最新课程 -> https://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要怎么安装

输入
  1. install gcc-4.8-multilib g++-4.8-multilib
复制代码

得到
  1. install: cannot stat ‘gcc-4.8-multilib’: No such file or directory
复制代码


加个yum也安装不成功
  1. yum install gcc-4.8-multilib g++-4.8-multilib
复制代码
  1. Loaded plugins: fastestmirror, langpacks
  2. Loading mirror speeds from cached hostfile
  3. * base: mirrors.ustc.edu.cn
  4. * extras: mirrors.ustc.edu.cn
  5. * updates: mirrors.ustc.edu.cn
  6. No package gcc-4.8-multilib available.
  7. No package g++-4.8-multilib available.
  8. Error: Nothing to do
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

输入

知识盲区,蹲大佬吧
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:40:41 | 显示全部楼层
  1. ls /
  2. ls /usr/include/c++
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 20:42:16 | 显示全部楼层
  1. [root@localhost chapter5]# ls /
  2. bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
  3. [root@localhost chapter5]# ls /usr/include/c++
  4. 4.8.2  4.8.5
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:43:33 | 显示全部楼层
  1. g++ --version
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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


这是我g++没有安装好来吗?
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:46:03 | 显示全部楼层
  1. ls /usr/include/c++/4.8.2/bits/c++config.h
  2. ls /usr/include/c++/4.8.5/bits/c++config.h
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:47:41 | 显示全部楼层
  1. g++ -v test2.cpp
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

使用道具 举报

发表于 2021-8-9 20:49:33 | 显示全部楼层
  1. ls /usr/include/c++/4.8.2/bits/
  2. ls /usr/include/c++/4.8.5/bits/
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-8-9 20:52:11 | 显示全部楼层
  1. [root@localhost bits]# ls /usr/include/c++/4.8.2/bits/
  2. algorithmfwd.h             hash_bytes.h             regex_constants.h          stl_numeric.h
  3. allocator.h                hashtable.h              regex_cursor.h             stl_pair.h
  4. alloc_traits.h             hashtable_policy.h       regex_error.h              stl_queue.h
  5. atomic_base.h              indirect_array.h         regex_grep_matcher.h       stl_raw_storage_iter.h
  6. atomic_lockfree_defines.h  ios_base.h               regex_grep_matcher.tcc     stl_relops.h
  7. basic_ios.h                istream.tcc              regex.h                    stl_set.h
  8. basic_ios.tcc              list.tcc                 regex_nfa.h                stl_stack.h
  9. basic_string.h             locale_classes.h         regex_nfa.tcc              stl_tempbuf.h
  10. basic_string.tcc           locale_classes.tcc       shared_ptr_base.h          stl_tree.h
  11. boost_concept_check.h      locale_facets.h          shared_ptr.h               stl_uninitialized.h
  12. c++0x_warning.h            locale_facets_nonio.h    slice_array.h              stl_vector.h
  13. char_traits.h              locale_facets_nonio.tcc  sstream.tcc                streambuf_iterator.h
  14. codecvt.h                  locale_facets.tcc        stl_algobase.h             streambuf.tcc
  15. concept_check.h            localefwd.h              stl_algo.h                 stream_iterator.h
  16. cpp_type_traits.h          mask_array.h             stl_bvector.h              stringfwd.h
  17. cxxabi_forced.h            memoryfwd.h              stl_construct.h            unique_ptr.h
  18. deque.tcc                  move.h                   stl_deque.h                unordered_map.h
  19. exception_defines.h        nested_exception.h       stl_function.h             unordered_set.h
  20. exception_ptr.h            ostream_insert.h         stl_heap.h                 uses_allocator.h
  21. forward_list.h             ostream.tcc              stl_iterator_base_funcs.h  valarray_after.h
  22. forward_list.tcc           postypes.h               stl_iterator_base_types.h  valarray_array.h
  23. fstream.tcc                ptr_traits.h             stl_iterator.h             valarray_array.tcc
  24. functexcept.h              random.h                 stl_list.h                 valarray_before.h
  25. functional_hash.h          random.tcc               stl_map.h                  vector.tcc
  26. gslice_array.h             range_access.h           stl_multimap.h
  27. gslice.h                   regex_compiler.h         stl_multiset.h
  28. [root@localhost bits]# ls /usr/include/c++/4.8.5/bits/
  29. algorithmfwd.h             hash_bytes.h             regex_constants.h          stl_numeric.h
  30. allocator.h                hashtable.h              regex_cursor.h             stl_pair.h
  31. alloc_traits.h             hashtable_policy.h       regex_error.h              stl_queue.h
  32. atomic_base.h              indirect_array.h         regex_grep_matcher.h       stl_raw_storage_iter.h
  33. atomic_lockfree_defines.h  ios_base.h               regex_grep_matcher.tcc     stl_relops.h
  34. basic_ios.h                istream.tcc              regex.h                    stl_set.h
  35. basic_ios.tcc              list.tcc                 regex_nfa.h                stl_stack.h
  36. basic_string.h             locale_classes.h         regex_nfa.tcc              stl_tempbuf.h
  37. basic_string.tcc           locale_classes.tcc       shared_ptr_base.h          stl_tree.h
  38. boost_concept_check.h      locale_facets.h          shared_ptr.h               stl_uninitialized.h
  39. c++0x_warning.h            locale_facets_nonio.h    slice_array.h              stl_vector.h
  40. char_traits.h              locale_facets_nonio.tcc  sstream.tcc                streambuf_iterator.h
  41. codecvt.h                  locale_facets.tcc        stl_algobase.h             streambuf.tcc
  42. concept_check.h            localefwd.h              stl_algo.h                 stream_iterator.h
  43. cpp_type_traits.h          mask_array.h             stl_bvector.h              stringfwd.h
  44. cxxabi_forced.h            memoryfwd.h              stl_construct.h            unique_ptr.h
  45. deque.tcc                  move.h                   stl_deque.h                unordered_map.h
  46. exception_defines.h        nested_exception.h       stl_function.h             unordered_set.h
  47. exception_ptr.h            ostream_insert.h         stl_heap.h                 uses_allocator.h
  48. forward_list.h             ostream.tcc              stl_iterator_base_funcs.h  valarray_after.h
  49. forward_list.tcc           postypes.h               stl_iterator_base_types.h  valarray_array.h
  50. fstream.tcc                ptr_traits.h             stl_iterator.h             valarray_array.tcc
  51. functexcept.h              random.h                 stl_list.h                 valarray_before.h
  52. functional_hash.h          random.tcc               stl_map.h                  vector.tcc
  53. gslice_array.h             range_access.h           stl_multimap.h
  54. gslice.h                   regex_compiler.h         stl_multiset.h
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:52:59 | 显示全部楼层
  1. g++ -v test2.cpp
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 20:54:08 | 显示全部楼层
  1. yum list | grep gcc
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

使用道具 举报

 楼主| 发表于 2021-8-9 20:57:04 | 显示全部楼层
  1. [root@localhost chapter5]# yum list | grep gcc
  2. gcc.x86_64                                  4.8.5-44.el7               @base   
  3. gcc-c++.x86_64                              4.8.5-44.el7               @base   
  4. libgcc.i686                                 4.8.5-44.el7               @base   
  5. libgcc.x86_64                               4.8.5-44.el7               @anaconda
  6. compat-gcc-44.x86_64                        4.4.7-8.el7                base     
  7. compat-gcc-44-c++.x86_64                    4.4.7-8.el7                base     
  8. compat-gcc-44-gfortran.x86_64               4.4.7-8.el7                base     
  9. gcc-gfortran.x86_64                         4.8.5-44.el7               base     
  10. gcc-gnat.x86_64                             4.8.5-44.el7               base     
  11. gcc-go.x86_64                               4.8.5-44.el7               base     
  12. gcc-objc.x86_64                             4.8.5-44.el7               base     
  13. gcc-objc++.x86_64                           4.8.5-44.el7               base     
  14. gcc-plugin-devel.x86_64                     4.8.5-44.el7               base     
  15. relaxngcc.noarch                            1.12-6.el7                 base     
  16. relaxngcc-javadoc.noarch                    1.12-6.el7                 base     
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-8-9 21:02:49 | 显示全部楼层
  1. yum search build-essential
  2. yum search gcc
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-26 22:40

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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