Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/usr/bin/locale: source file is not valid UTF-8

Tags:

c++

macos

g++

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 I run:

g++ hello.cpp

error

like image 934
Lin Weiye Avatar asked Oct 25 '25 00:10

Lin Weiye


1 Answers

CPLUS_INCLUDE_PATH environment variable has an incorrect value.

Simple fix:

export CPLUS_INCLUDE_PATH=":/usr/local/include"
like image 145
Lin Weiye Avatar answered Oct 27 '25 15:10

Lin Weiye



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!