using g++ to compile cpp file in macOS.
macOS v10.15.4
Apple clang version 11.0.3 (clang-1103.0.32.62)
hello.cpp
#include <iostream> using namespace std; int main() { cout << "hello word" << endl; return 0; }
in terminal
g++ hell.cpp
Similar problem happend for me on Catalina10.15.7 + gcc10.2( homebrew), and CPLUS_INCLUDE_PATH method from Lin Weiye didn't work somehow.
Manually changing line 140 of ostream header from
include <locale>
to
include "locale"
did work. This will stop ostream from looking for locale executable via PATH, and force to look locale header in the same directory where ofstream header is.
file hello.cpp
... what does it say? – Eljaylocale
executable on your system and treating it as the<locale>
header that<iostream>
uses. Why? No idea. – chrisCPATH
andCPLUS_INCLUDE_PATH
environment variables? (echo $CPATH
etc.) Do they include/usr/bin
? – chris