我正在使用 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/