g++ 编译 C++ 错误 /usr/bin/locale: source file is not valid UTF-8

macOS V10.15.4

macOS 下使用命令 g++ 编译 C++ 文件错误提示 /usr/bin/locale: error: source file is not valid UTF-8

hello.cpp 文件

#include <iostream>
using namespace std;

int main()
{
  cout << "hello word" << endl;
  return 0;
}

编译

g++ hell.cpp

提示错误

Screen Shot 2020-06-28 at 07.38.14.png

阅读 253
评论
    1 个回答

    it is CPLUS_INCLUDE_PATH environment variables error.

    Setting export CPLUS_INCLUDE_PATH=":/usr/local/include"

    CPLUS_INCLUDE_PATH 环境变量设置问题

    配置 export CPLUS_INCLUDE_PATH=":/usr/local/include"

      撰写回答

      登录后参与交流、获取后续更新提醒