c++ - 错误 :cannot convert 'std::complex<double>' to '__complex__ float' in initialization

标签 c++

我不断收到标题中发布的错误。我拥有的 C++ 代码将在 C++98 中运行,但不会在我需要使用的任何后续 C++ 版本(如 11 或 14 等)中运行。

有什么想法吗?

    extern _Complex float gRESAMPLE_DSSS_PAGEDCOEFS_REVERSE_CONJ_TAPS17_STEP5000KHZ_BW20MHZ_FS20MHZ[];

_Complex float gRESAMPLE_DSSS_PAGEDCOEFS_REVERSE_CONJ_TAPS17_STEP5000KHZ_BW20MHZ_FS20MHZ[187] =
{
+1.91232115e-02-0.00000000e+00i, +2.05319226e-02-0.00000000e+00i, -2.72482540e-02-0.00000000e+00i, +4.17710021e-02-0.00000000e+00i,
-6.60308301e-02-0.00000000e+00i, +1.07876487e-01-0.00000000e+00i, -1.98891580e-01-0.00000000e+00i, +6.31532013e-01-0.00000000e+00i,
+6.31532013e-01-0.00000000e+00i, -1.98891580e-01-0.00000000e+00i, +1.07876487e-01-0.00000000e+00i, -6.60308301e-02-0.00000000e+00i,
+4.17710021e-02-0.00000000e+00i, -2.72482540e-02-0.00000000e+00i, +2.05319226e-02-0.00000000e+00i, +1.91232115e-02-0.00000000e+00i,
-2.01950068e-04-0.00000000e+00i, +1.57716405e-02-0.00000000e+00i, +2.58155894e-02-0.00000000e+00i, -3.05156335e-02-0.00000000e+00i,
+4.43429612e-02-0.00000000e+00i, -6.73551857e-02-0.00000000e+00i, +1.05998978e-01-0.00000000e+00i, -1.86539873e-01-0.00000000e+00i,
+5.19834042e-01-0.00000000e+00i, +7.33756542e-01-0.00000000e+00i, -1.96507320e-01-0.00000000e+00i, +1.01235323e-01-0.00000000e+00i,
-5.93557656e-02-0.00000000e+00i, +3.57483588e-02-0.00000000e+00i, -2.17679292e-02-0.00000000e+00i, +1.41898394e-02-0.00000000e+00i,
+2.25500409e-02-0.00000000e+00i, +4.04566905e-04-0.00000000e+00i, +1.26300994e-02-0.00000000e+00i, +2.98684780e-02-0.00000000e+00i,
-3.14745754e-02-0.00000000e+00i, +4.35172319e-02-0.00000000e+00i, -6.36360645e-02-0.00000000e+00i, +9.64822844e-02-0.00000000e+00i,
};

实际上复杂矩阵的大小实际上是 187 大....我只是为了房间的缘故没有粘贴它。

谢谢

标记

最佳答案

_Complex float是 C 风格的复数,它不应该存在于 C++ 中。您的编译器允许它作为扩展。

1.23i是 C++ std::complex字面意思。

_Complexstd::complex彼此不兼容。您应该使用其中之一。

替换_Complex floatstd::complex<float>在你的代码中到处,并更改 1.23i文字(类型 std::complex<double> )到 1.23if (std::complex<float>)。

或者,替换 1.23i带有 1.23*I 的文字( Icomplex.h 中定义)。

关于c++ - 错误 :cannot convert 'std::complex<double>' to '__complex__ float' in initialization,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59252382/

相关文章:

c++ - 无法在 QtCreator 中使用 g++ 7.2 使用 c++17 功能

c++ - std::sort 用于 C++ 中的二维 vector

c++ - 类模板特化的问题

C++ - std::bind call operator() 完美转发

c++ - 如何在 Visual Studio 中的第一个断言失败时停止?

c++ - 在控制结构 block 中定义变量

c++ - C++中隐式构造的变量

c++ - 如何使用 WAF 链接静态库?

c++ - 在您配置的INTEL C++编译器(Linux)的搜索路径中找不到可执行文件

c++ - 是否有任何标准可以在 native C++ 中使用 Web 服务?