I want to run g++-14 which I installed through brew install gcc
so I can use the most up to date version of C++, but after installing I get a lot of errors when trying to compile code.
All the errors are way too long to copy here, but the last few are
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/malloc/_malloc_type.h:66:1: error: '__API_UNAVAILABLE3' does not name a type
66 | _MALLOC_TYPE_AVAILABILITY void *malloc_type_zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(3);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/stdlib.h:182:1: error: expected unqualified-id before numeric constant
182 | __API_AVAILABLE(macos(10.0)) __IOS_PROHIBITED
| ^~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/stdlib.h:220:56: error: expected initializer before '__API_AVAILABLE2'
220 | int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3));
| ^~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/stdlib.h:351:9: error: expected initializer before '__API_AVAILABLE2'
351 | __API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0), watchos(6.0));
| ^~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/stdlib.h:359:9: error: expected initializer before '__API_AVAILABLE2'
359 | __API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0));
| ^~~~~~~~~~~~~~~
/usr/local/Cellar/gcc/14.1.0/include/c++/14/cstdlib:173:11: error: 'system' has not been declared in '::'
173 | using ::system;
| ^~~~~~
Running g++-14 --version
outputs the following
g++-14 (Homebrew GCC 14.1.0) 14.1.0
Copyright (C) 2024 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.