0

Clang Compiles, but GCC does not.

/usr/local/Cellar/gcc/12.2.0/include/c++/12/cwchar:44:10: fatal error: wchar.h: No such file or directory
       44 | #include <wchar.h>
Aaron Liu
  • 361
  • 2
  • 13
tom_kp
  • 21
  • 4
  • Is there a `cwchar` file in `/usr/local/Cellar/gcc/12.2.0/include/c++/12/`? If so, what does it say? – Aaron Liu Apr 07 '23 at 22:58
  • Try reinstalling the xcode command line tools and possibly the home brew packages too – Alan Birtles Apr 08 '23 at 01:14
  • @Aaron Liu Thanks Aaron. Yes there is cwchar in it. – tom_kp Apr 08 '23 at 01:58
  • @Alan Birtles Thanks Alan. I did both, still it is not compiling. – tom_kp Apr 08 '23 at 02:12
  • @AlanBirtles Would you kindly reopen this? That question was after an upgrade from mavericks, the instructions are NOT relevant as they did not make the same change. Plus, I doubt command line tools are relevant as OP is using actual g++ from homebrew. – Aaron Liu Apr 08 '23 at 02:25
  • Thanks Aaron. cwchar is a forwarding header. /** @file include/cwchar * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * This is the C++ version of the Standard C Library header @c wchar.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ – tom_kp Apr 08 '23 at 02:51
  • @AaronLiu it's exactly the same error and it's highly likely that one of the solutions in there fixes the problem. If not then whatever solution is better added there to keep them all in the same place for others to find when they Google the error – Alan Birtles Apr 08 '23 at 06:56
  • @AlanBirtles It is not the same error. This one's homebrew'd g++ while that question's apple clang. Homebrew'd g++'s include DID NOT change. Apple Clang's DID change during an upgrade from MAVERICKS (not ventura). Just the clang/g++ difference alone means none of the answers to that question could ever be useful to this question. – Aaron Liu Apr 08 '23 at 13:09

0 Answers0