visual studio para online macbook mac devc dev compilar c++ macos compilation std macos-high-sierra

studio - xcode c++



Las bibliotecas c++ std rotas en macOS High Sierra 10.13 (4)

Recientemente compré un nuevo MacBook en el que transferí mi sesión anterior. Desde entonces, y luego de actualizar a la versión 10.13, no puedo hacer que clang compile nada, incluido solo iostream.
Dado este programa:

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

me da esta salida cuando 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.

Intenté lo siguiente:

  • Restablecer CLT con Xcode-select --reset
  • Reinstalar CLT
  • Reinstalar Xcode

Ninguna de estas soluciones funcionó y esto comenzó a volverme loco. ¿Alguien tiene el mismo problema y encontró una solución?

EDIT: Los proyectos de Xcode C ++ se están compilando con éxito, aún no entiendo por qué no lo haría en una terminal.


Compruebe que no incluya "/ usr / local / include" en la ruta de búsqueda de encabezados de su proyecto.


Tuve exactamente el mismo problema después de transferir a macOS High Sierra (sin embargo, los errores no eran los mismos, pero eran similares).

Encontré una solución al cambiar el nombre de /usr/local/include a /usr/local/include_old (bueno, el nombre no importa realmente, solo el hecho de que g++/clang ya no busque más encabezados en esta carpeta).


Tuve exactamente el mismo problema hoy y después de ejecutar xcode-select --install , ¡todo funciona bien!


Tuve un problema similar que, después de actualizar a high sierra (y Xcode 9.1), mi estándar hace advertencias desconocidas.

Dibujó archivos .h desde /usr/local/include lugar de (como pensé) estándar /usr/include . Por ejemplo, no había zlib.h disponible.

Reinstalar Xcode (quien dice haber instalado la versión de línea de comandos también) no ayudó.

No hubo /usr/include en absoluto, pero el sistema C ++ include estaba disponible a través de los enlaces publicados en clang --version , pero ninguno de los C-include.

Después de xcode-select --install y en realidad "instale" el material de la línea de comandos /usr/include se completó con las bibliotecas de C necesarias, y comience a compilar sin advertencias nuevamente.