C ++中的函数为什么我的编译器无法识别错误()
function in c++ why my compiler didn't recognize the error()
在 C++ 中使用 error(( 函数时出错。
我的问题是当我想在我的代码中包含 error(( 函数时,我得到编译错误。
编译器似乎无法识别此功能。
int some_function(){
double input{0};
cin>>input;
if(!cin){
error("couldn't read double in 'some_function()'");
return -1;
}
当我输入例如字符串时,我希望消息"无法在'some_function(('中读取双倍"。
C++标准库中没有error
函数。编译器无法"识别"此函数,因为它不存在。
为什么你认为应该有这样的功能?
如果要在C++中打印错误消息,通常的方法是使用cerr
流:
std::cerr << "couldn't read double in 'some_function()'n";
相关文章:
- C++出现控制台错误.我无法识别源代码的问题
- C++ 编译错误:gnu_printf是无法识别的格式函数类型
- 哗啦��错误:无法识别任何一组可以驱动指定关节的控制器
- GCC-7:错误:无法识别的命令行选项"-M64"
- C ++中的函数为什么我的编译器无法识别错误()
- OPENCV错误在XCode 8中加载Fisher面部识别器时
- 如何修复 Typedef 变量未识别错误 C++ (Visual Studio 2017)
- if 语句错误地识别括号中的空格
- 无法识别的模板声明错误 - 不明白我做错了什么
- 需要帮助识别简单多线程代码中的错误
- 识别指针处理方式中的错误
- 将“getopt_long”与无法识别的长选项一起使用时出现分段错误
- Windows Web Services框架中发生了无法识别的错误
- QT5对QinputDialog和Qmessagebox的未识别引用.错误
- 插入protobuf时SQLite无法识别的令牌错误:要处理哪些令牌以及如何处理?
- 控制台崩溃,尚无法识别错误
- 构建时OPENCV流量信号识别错误
- jenkins在构建cpp代码时不会识别错误
- 在g++中添加-M标志会导致文件格式不可识别错误
- 循环的范围识别错误的类型(C2440)