C++ 编译窗口包含垃圾字符

标签 c++ emacs

我正在使用 emacs 编译 C++ 程序。在编译窗口中,我得到了垃圾字符。下面给出了示例。

#include <iostream>
#include <string>

using namespace std;


int main()   
{   
 error

}

我正在使用编译命令在 emacs 中编译它

g++  error.cpp

在编译窗口中,出现以下错误。

g++ error.cpp 
error.cpp: In function âint main()â:
error.cpp:10:3: error: âerrorâ was not declared in this scope
error.cpp:12:1: error: expected â;â before â}â token

Compilation exited abnormally with code 1 at Wed Jan 23 17:09:17

正如您所注意到的,窗口中有一些乱码(许多乱码在粘贴过程中消失了!)。如何避免这种情况? .如果我在终端中进行编译,我看不到问题。

我在 ubuntu 12.10 中使用 emacs 24.1.1

最佳答案

在许多语言环境中,gcc 编译器在它打算发出单引号字符时发出字符 â(我不知道为什么要这样做)。

尝试将语言环境设置为默认的 C 语言环境。

关于C++ 编译窗口包含垃圾字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14478978/

相关文章:

c++ - 如何在 Visual C++ 中使用#pragma 同时启用两个语言环境?

c++ - 用不等式并行化 for 循环 (openmp c++​​)

c++ - 如何向 C++ 日志宏添加额外参数

emacs - 将 Emacs AUCTeX 与 Sumatra PDF 同步

Emacs:cua 模式有更好的 PgDn/PgUp 行为吗?

vim - Emacs 按字符快速导航?

c++ - 使用CodeBlocks编译64位DLL会导致链接器错误

c++ - 对构造函数的调用可以被视为函数声明吗?

linux - Emacs 粘贴不起作用

python - 自动完成不起作用 : emacs elpy-mode