使用istringstream给出错误|原因
Using istringstream gives error | Why
我已经创建了一个二进制文件。其中,数据以二进制形式存储但我将以人类可读的形式显示,如;
[someOtherData]6759A_block$[someOtherData]
我将数据"6759A_block$"保存在temp_S中,它被声明为string。现在,我想从temp_S中拆分前3个字节,然后将其存储在unsigned int中。为了实现我的愿望,我写了下面的代码段;
unsigned int number;
{
string tmp ( temp_S , 0 ,3 );
istringstream temp_Istream ( tmp ) ;
temp_Istream >> number;
}
然而,当我编译我的小程序时,它给出了如下所示的错误;
error: variable ‘std::istringstream temp_S’ has initializer but incomplete type
我的问题是:
- 这个编译错误是什么意思?
- 如何解决这个问题,并采取前三个字节的数据unsigned int ?
- <
- 平台linux/gh>
- g++
当您忘记这个时,GCC会给出错误:
#include <sstream> //this is where istringstream is defined
相关文章:
- 我无法缩小此分段错误的原因
- 没有可行的过载'='错误,可能导致这种情况的原因是什么?
- 我不知道导致错误的原因 (C3074)
- 我遇到了黑客排名中的问题"TWO STRINGS"的三个测试用例的分段错误。原因是什么?
- 编译错误:"lvalue required as left operand of assignment" 不确定原因
- 导致hash_map错误的原因是什么,如何修复它?
- 当我选择大于 720 的矩阵大小时,程序退出并显示错误代码.可能是什么原因?
- 出现这种错误的原因是什么"invalid use of non-static data member "
- AddressSanitizer 将 std::vector<T>::p ush_back 标识为释放后堆使用错误的原因
- 这种错误的原因是什么:将"功能"重新定义为不同类型的符号
- 由于选项卡顺序的原因,鼠标光标总是得到错误的hwnd-MFC应用程序
- 由于某种原因,我的代码中出现了 [json.exception.type_error.302]。我知道错误意味着什么,但我不知道哪里有故障
- 失败时如何获取错误原因curl_easy_init
- 我的代码中出现运行时错误的可能原因是什么?
- Arduino IDE中自定义库类的.h文件编译错误的原因是什么
- 将VS2013 更新为VS2019会导致左值错误,想知道原因
- C :(不重复)积分静态成员初始化(不仅是声明!),导致链接器错误,原因
- 什么原因导致我的"‘FatalError’ in namespace ‘Foam’ does not name a type"错误?
- 此代码中运行时间错误的原因是什么
- 我使用代码 1 出现分段错误的原因可能是什么