关于如何解决这个错误的任何想法
Any Ideas on how to fix this error?
当我试图在Unix服务器上编译我的c++代码时,我一直得到一个异常,但是这些行只有:
#ifndef WEIGHTED_GRAPH_H
#endif
,错误是:
In file included from Weighted_graph_tester.h:17,
from Weighted_graph_driver.cpp:18:
Weighted_graph.h:1: error: stray â357â in program
Weighted_graph.h:1: error: stray â273â in program
Weighted_graph.h:1: error: stray â277â in program
Weighted_graph.h:1: error: stray â#â in program
In file included from Weighted_graph_tester.h:17,
from Weighted_graph_driver.cpp:18:
Weighted_graph.h:172:2: error: #endif without #if
Weighted_graph.h:1: error: âifndefâ does not name a type
任何想法?
它告诉您文件中有以下字节:
Oct: 357 273 277
Hex: EF BB BF
这些是UTF-8编码文件中的字节顺序标记。显然,编译器不支持开头有字节顺序标记的UTF-8源文件。实际上,在UTF-8文件中使用字节顺序标记是没有意义的,因为任何单个单元的大小都只有一个字节。你应该确保你保存了没有它的文件。
来自Unicode标准:
对于UTF-8,既不需要也不推荐使用BOM,但在使用BOM的其他编码形式转换UTF-8数据或将BOM用作UTF-8签名的上下文中可能会遇到。
相关文章:
- 我是 c++ 的新手.学习基本知识后,我想做井字游戏.对于印刷板,我在下面写代码,但它显示错误
- 类和构造函数中的函数根本不起作用,并且不返回任何错误
- 如果用户没有输入任何内容或输入错误,如何重新输入用户的输入?
- 我想在 c++ 中对单向链表进行冒泡排序,但我一直面临左值错误,无法解决它
- 我正在尝试一个傻瓜 C++ 练习,我遇到了一个错误,说类 'GraduateStudent' 没有任何名为 'advisor' 的字段
- 零四元数和任何向量都不为零的特征积,这是一个错误吗?
- 如何用 C 编译,但如果使用任何C++,则会抛出错误?
- 编译器没有显示错误,但我没有得到任何输出.怎么了?
- 如何在 if 语句中声明对象并在任何我想的地方使用它?
- MSVC 错误:4 个重载中的任何一个都无法转换所有参数类型
- 我的代码中是否有任何类型的错误,因为它没有给出正确的输出
- 如果我想使用 cout 为我的函数提供任何输入......我该如何给出
- 函数和指针帮助:程序生成,但崩溃,没有任何特定错误
- 无法编译任何C++程序;错误:未知类型名称'uint8_t'
- 无法在vs2012中生成任何c++项目.错误LNK1327:rc.exe
- 声明不声明任何[-fpermission]错误
- 我的C++从文本文件读取的程序无法正常工作,但我没有看到任何代码错误?
- 在c++中使用同一个fstream对象进行读写时,是否有任何导致错误的特性
- 我没有任何编译错误,但我的代码不起作用。怎么了?
- 捕获 Segfault 或任何其他错误/异常/信号C++例如在 Java 中捕获异常