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

标签 c++ macos g++

在 macOS 中使用 g++ 编译 cpp 文件。
macOS v10.15.4
Apple clang 版本 11.0.3 (clang-1103.0.32.62)
你好.cpp

#include <iostream>
using namespace std;

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

in terminal

g++ hell.cpp
error

最佳答案

CPLUS_INCLUDE_PATH环境变量的值不正确。
简单的修复:

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

关于c++ -/usr/bin/locale : source file is not valid UTF-8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62617618/

相关文章:

c++ - qwebengineview qt5.9如何提取数据

c++ - 如何使用 NASM 创建 .dll 文件?

c++ - 使用 erase 从 std::string 从 "("到 ")"删除字符?

c++ - Typedef 到 C++ 中的周围类型

c++ - Dr.Memory 发现的错误 : don't know how to fix it

macos - SVN 忽略 OS X Lion 中的问题

cocoa - 在 Mac OS 中监视剪贴板

macos - 如何检测 NSTableView 上的 rightMouseDown 和 **otherMouseDown** ?

c++ - 在 g++ 中编译 Windows C++ 程序

Linux 和 cocos2d : 'cc1plus' : execvp: No such file or directory