1. <i id='xQlhT'><tr id='xQlhT'><dt id='xQlhT'><q id='xQlhT'><span id='xQlhT'><b id='xQlhT'><form id='xQlhT'><ins id='xQlhT'></ins><ul id='xQlhT'></ul><sub id='xQlhT'></sub></form><legend id='xQlhT'></legend><bdo id='xQlhT'><pre id='xQlhT'><center id='xQlhT'></center></pre></bdo></b><th id='xQlhT'></th></span></q></dt></tr></i><div id='xQlhT'><tfoot id='xQlhT'></tfoot><dl id='xQlhT'><fieldset id='xQlhT'></fieldset></dl></div>
  2. <tfoot id='xQlhT'></tfoot>

    <small id='xQlhT'></small><noframes id='xQlhT'>

      <bdo id='xQlhT'></bdo><ul id='xQlhT'></ul>

      <legend id='xQlhT'><style id='xQlhT'><dir id='xQlhT'><q id='xQlhT'></q></dir></style></legend>

      macOS High Sierra 10.13 上损坏的 c++ std 库

      时间:2023-10-17

    1. <i id='MIwMz'><tr id='MIwMz'><dt id='MIwMz'><q id='MIwMz'><span id='MIwMz'><b id='MIwMz'><form id='MIwMz'><ins id='MIwMz'></ins><ul id='MIwMz'></ul><sub id='MIwMz'></sub></form><legend id='MIwMz'></legend><bdo id='MIwMz'><pre id='MIwMz'><center id='MIwMz'></center></pre></bdo></b><th id='MIwMz'></th></span></q></dt></tr></i><div id='MIwMz'><tfoot id='MIwMz'></tfoot><dl id='MIwMz'><fieldset id='MIwMz'></fieldset></dl></div>
    2. <legend id='MIwMz'><style id='MIwMz'><dir id='MIwMz'><q id='MIwMz'></q></dir></style></legend>

      • <small id='MIwMz'></small><noframes id='MIwMz'>

              <bdo id='MIwMz'></bdo><ul id='MIwMz'></ul>

              <tfoot id='MIwMz'></tfoot>
                <tbody id='MIwMz'></tbody>

              1. 本文介绍了macOS High Sierra 10.13 上损坏的 c++ std 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我最近买了一台新的 MacBook,我在上面转移了我的旧会话.从那时起,在我升级到 10.13 之后,我无法让 clang 编译任何内容,包括仅 iostream.
                鉴于这个程序:

                I recently bought a new MacBook on which I transferred my old session. Since then, and after i upgraded to 10.13, i can't get clang to compile anything including only iostream.
                Given this program :

                #include <iostream>
                
                int main(void)
                {
                    std::cout << "Hello world !" << std::endl;
                    return 0;
                }
                

                g++ main.cpp 时给我这个输出:

                gives my this output when g++ main.cpp :

                In file included from main.cpp:1:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:171:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:640:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:86:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:94:
                In file included from /usr/include/stdlib.h:65:
                In file included from /usr/include/sys/wait.h:110:
                In file included from /usr/include/sys/resource.h:72:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdint.h:119:
                In file included from /usr/local/include/stdint.h:82:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/inttypes.h:247:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
                /usr/include/inttypes.h:235:8: error: unknown type name 'intmax_t'
                extern intmax_t
                       ^
                /usr/include/inttypes.h:236:9: error: unknown type name 'intmax_t'
                imaxabs(intmax_t j);
                        ^
                /usr/include/inttypes.h:240:2: error: unknown type name 'intmax_t'
                        intmax_t quot;
                        ^
                /usr/include/inttypes.h:241:2: error: unknown type name 'intmax_t'
                        intmax_t rem;
                        ^
                /usr/include/inttypes.h:246:9: error: unknown type name 'intmax_t'
                imaxdiv(intmax_t __numer, intmax_t __denom);
                        ^
                /usr/include/inttypes.h:246:27: error: unknown type name 'intmax_t'
                imaxdiv(intmax_t __numer, intmax_t __denom);
                                          ^
                /usr/include/inttypes.h:250:8: error: unknown type name 'intmax_t'
                extern intmax_t
                       ^
                /usr/include/inttypes.h:256:8: error: unknown type name 'uintmax_t'; did you
                      mean 'uintptr_t'?
                extern uintmax_t
                       ^
                /usr/include/sys/_types/_uintptr_t.h:30:24: note: 'uintptr_t' declared here
                typedef unsigned long           uintptr_t;
                                                ^
                In file included from main.cpp:1:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:171:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:640:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:86:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:94:
                In file included from /usr/include/stdlib.h:65:
                In file included from /usr/include/sys/wait.h:110:
                In file included from /usr/include/sys/resource.h:72:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdint.h:119:
                In file included from /usr/local/include/stdint.h:82:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/inttypes.h:247:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
                /usr/include/inttypes.h:263:8: error: unknown type name 'intmax_t'
                extern intmax_t
                       ^
                /usr/include/inttypes.h:269:8: error: unknown type name 'uintmax_t'; did you
                      mean 'uintptr_t'?
                extern uintmax_t
                       ^
                /usr/include/sys/_types/_uintptr_t.h:30:24: note: 'uintptr_t' declared here
                typedef unsigned long           uintptr_t;
                                                ^
                In file included from main.cpp:1:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:171:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:640:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:86:
                In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:94:
                In file included from /usr/include/stdlib.h:65:
                In file included from /usr/include/sys/wait.h:110:
                /usr/include/sys/resource.h:197:2: error: unknown type name 'uint64_t'
                        uint64_t ri_user_time;
                        ^
                /usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t'
                        uint64_t ri_system_time;
                        ^
                /usr/include/sys/resource.h:199:2: error: unknown type name 'uint64_t'
                        uint64_t ri_pkg_idle_wkups;
                        ^
                /usr/include/sys/resource.h:200:2: error: unknown type name 'uint64_t'
                        uint64_t ri_interrupt_wkups;
                        ^
                /usr/include/sys/resource.h:201:2: error: unknown type name 'uint64_t'
                        uint64_t ri_pageins;
                        ^
                /usr/include/sys/resource.h:202:2: error: unknown type name 'uint64_t'
                        uint64_t ri_wired_size;
                        ^
                /usr/include/sys/resource.h:203:2: error: unknown type name 'uint64_t'
                        uint64_t ri_resident_size;
                        ^
                /usr/include/sys/resource.h:204:2: error: unknown type name 'uint64_t'
                        uint64_t ri_phys_footprint;
                        ^
                /usr/include/sys/resource.h:205:2: error: unknown type name 'uint64_t'
                        uint64_t ri_proc_start_abstime;
                        ^
                fatal error: too many errors emitted, stopping now [-ferror-limit=]
                20 errors generated.
                

                我尝试了以下方法:

                • 使用 Xcode-select --reset
                • 重置 CLT
                • 重新安装 CLT
                • 重新安装Xcode

                这些解决方案都没有奏效,这开始让我发疯.有人有同样的问题并找到了解决方案吗?

                None of these solution worked and this starting to drive me crazy. Does somebody has the same problem and found a solution ?

                Xcode C++ 项目已成功编译,但仍然不明白为什么它不会在终端中.

                EDIT : Xcode C++ Projects are successfully compiling, still don't understand why it would not in a terminal.

                推荐答案

                我在转移到 macOS High Sierra 后遇到了完全相同的问题(虽然,错误不一样,但相似).

                I had exactly the same problem after transferring to macOS High Sierra (though, errors were not the same, but similar).

                我通过将 /usr/local/include 重命名为 /usr/local/include_old 找到了一种解决方法(好吧,名称并不重要,只是事实上 g++/clang 将不再在此文件夹中搜索标题).

                I found a workaround by renaming /usr/local/include to /usr/local/include_old (well, name does not really matter, just the fact that g++/clang will not search for headers in this folder anymore).

                这篇关于macOS High Sierra 10.13 上损坏的 c++ std 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:我可以在 C 程序中使用在 C++ 中创建的共享库吗? 下一篇:是否有理由不使用链接时优化 (LTO)?

                相关文章

                    <small id='R8RSi'></small><noframes id='R8RSi'>

                    <tfoot id='R8RSi'></tfoot>
                  1. <legend id='R8RSi'><style id='R8RSi'><dir id='R8RSi'><q id='R8RSi'></q></dir></style></legend>
                    • <bdo id='R8RSi'></bdo><ul id='R8RSi'></ul>
                    <i id='R8RSi'><tr id='R8RSi'><dt id='R8RSi'><q id='R8RSi'><span id='R8RSi'><b id='R8RSi'><form id='R8RSi'><ins id='R8RSi'></ins><ul id='R8RSi'></ul><sub id='R8RSi'></sub></form><legend id='R8RSi'></legend><bdo id='R8RSi'><pre id='R8RSi'><center id='R8RSi'></center></pre></bdo></b><th id='R8RSi'></th></span></q></dt></tr></i><div id='R8RSi'><tfoot id='R8RSi'></tfoot><dl id='R8RSi'><fieldset id='R8RSi'></fieldset></dl></div>