OSX: Can't compile anymore

For some reason I am now unable to compile even a simple hello world, in my mac, using g++ (or clang++ or anything fwiw).

The last thing I recall I did was install llvm through homebrew.

Using g++ -isysroot /Applications/Xcode.app/Contents/Developer/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk main.cpp seem to work, but I used to be able to just use g++ main.cpp

Can anyone think of a reason for this to happen?

This is main.cpp
1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;

int main() 
{
    cout << "Hello, World!";
    return 0;
}


This is an extract of the output from g++ main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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:215:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:90:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/wchar.h:133:77: error:
      use of undeclared identifier 'wcschr'
wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
                                                                            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/wchar.h:140:87: error:
      use of undeclared identifier 'wcspbrk'
wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}
                                                                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/wchar.h:147:78: error:
      use of undeclared identifier 'wcsrchr'; did you mean 'wcschr'?
wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);}
....
....
In case anyone happens to have the same issue.. I managed to fixed this by renaming my `/usr/local/include` folder to `/usr/local/include_old`
Um... do you understand what the problem was?

Do you understand why what you did fixed it?

Because... just renaming your entire system include directory does not sound like a safe and sensible thing to do, and certainly not good advice to be giving other people.
Topic archived. No new replies allowed.