错误:预期";"
Error : expected a ";"
这是一个愚蠢的问题,但我有一个错误:
#include <unordered_set>
std::unordered_set<std::string> ValidValues **{**"one", "two", "three"};
错误:预期a;出现在第一个括号中。与"集"相同。
重新启动视觉工作室和计算机。
这有效:
#include <string>
#include <unordered_set>
std::unordered_set<std::string> ValidValues {"one", "two", "three"};
使用GCC 4.4 ,Clang 3.1 和MSVS2013 。
MSVS2010/2012不支持称为列表初始化的语言功能,Wich是您正在做的。
相关文章:
- 将鼠标悬停在问题上时与预期">"相关的代码错误
- 方法内部但循环仍得到预期的不合格id错误C++
- holeMenuProgram.cpp:38:1 错误:'}'令牌之前的预期主表达式
- 'val' Arduino 错误代码之前的预期'('
- 错误 C2760:语法错误:映射迭代器上意外的标记"标识符",预期的";"
- 语句错误:"","标记之前有"预期的')'
- 内存错误低于在C++年实现埃拉托色尼筛分时的预期
- 编译 llvm 3.1 时,为什么会出现错误:在">"标记之前预期主表达式
- Arduino 用于语句错误。令牌之前的预期')' ';'。如何解决这个问题?
- 生成错误 - "." 标记之前的预期主表达式
- 在编译时,C++项目抛出错误 C2228,这是预期的,因为控件在运行时未达到该点
- C++ 编译错误:意外的类型名称"字符串":预期的表达式
- SFML:错误:")"标记之前的预期主表达式
- 使用直接大括号初始化时,C++ 编译错误"声明末尾的预期";"
- 错误:'int'之前的预期主表达式以及代码中的许多类似错误
- turbo 为什么我的C++代码中出现错误类型名称预期"错误?
- 如何在输入结束时修复预期}错误
- 预期"{"错误?以及预期的未指定 ID 错误?
- 虚拟函数覆盖预期错误
- While & If 循环预期错误