我正在编译 C++ 代码来运行 DFT。我在我的代码中使用 quadmath 和一个随机数生成器来增加噪音。 运行代码时:
g++ code.cc -lquadmath -o quad
我没有得到任何错误并且编译成功, 但是由于使用了随机数生成器,我必须编译为
g++ code.cc -lquadmath -std=gnu++0x -o quad
给出了一个错误 lvaule 作为赋值的左操作数。 抛出此错误的代码行是:
std::real(output_seq[y]) =std::real(output_seq[y])+( V2[x] * cosineA );
最佳答案
您正在尝试为 std::real
的结果赋值,这是一个 rvalue .
这和写作一样有意义
5.0f = std::real(output_seq[y]) + (V2[x] * cosineA);
所以你可能想这样做
output_seq[y] = std::real(output_seq[y]) + (V2[x] * cosineA);
关于c++ - 错误 : lvalue required as left operand of assignment using quadmath and random number generator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28444032/