C++错误:"use of deleted function" minGW_32,Qt 5.7.0,Windows 10



我会得到以下错误消息,尝试编译以下代码

main_LoSignalDelayOnCoherence.cpp:56: error: use of deleted function 'CrossSpectrum::CrossSpectrum(const CrossSpectrum&)'
CrossSpectrum( frameLen, SIGLIB_HANNING ) };

相应的线生成main_LoSignalDelayOnCoherence中的错误是:

CrossSpectrum XS[numOfFFT] = {
    CrossSpectrum( frameLen, SIGLIB_HANNING ),
    CrossSpectrum( frameLen, SIGLIB_HANNING ),
    CrossSpectrum( frameLen, SIGLIB_HANNING ),
    CrossSpectrum( frameLen, SIGLIB_HANNING ),
    CrossSpectrum( frameLen, SIGLIB_HANNING ),
    CrossSpectrum( frameLen, SIGLIB_HANNING ),
    CrossSpectrum( frameLen, SIGLIB_HANNING ),
    CrossSpectrum( frameLen, SIGLIB_HANNING ),
    CrossSpectrum( frameLen, SIGLIB_HANNING ) };

CrossSpectrum的标头文件是:

class CrossSpectrum : public rFFT
{
    Q_OBJECT
public:
    CrossSpectrum(
    SLArrayIndex_t FFTLength = 1024,                    // Power of 2
    const SLWindow_t windowType = SIGLIB_RECTANGLE,
    QObject *parent = NULL );   
    ~CrossSpectrum();
// notice, no assignment and copy constructor defined
...
}

相应的实现文件是:

CrossSpectrum::CrossSpectrum ( 
                                SLArrayIndex_t FFTLength,
                                const enum SLWindow_t windowType,
                                QObject *parent )
                                : rFFT( FFTLength, windowType, true, parent )
{
    mpTemp = SUF_VectorArrayAllocate( mFFTLength );
    mpTemp2 = SUF_VectorArrayAllocate( mFFTLength );
    mpCplxTemp = SUF_ComplexRectArrayAllocate( mFFTLength );
    mpCplxTemp2 = SUF_ComplexRectArrayAllocate( mFFTLength );
    mpCplxTemp3 = SUF_ComplexRectArrayAllocate( mFFTLength );
    mpAccumulatedAutoSpectrum1 = SUF_VectorArrayAllocate( mFFTLength );
    mpAccumulatedAutoSpectrum2 = SUF_VectorArrayAllocate( mFFTLength );
    mpAccumulatedCrossSpectrum = SUF_ComplexRectArrayAllocate( mFFTLength );
    reset();
}
...

我了解编译器正在抱怨尚未提供复制构造函数,这也不是为了这样的构造是没有意义的。我的问题是:

  1. 我不明白应该在哪里完成副本!
  2. 我该如何解决这个问题?

注意:该软件在Microsoft VC9(Visual Studio 2008)和QT4.8。

下进行编译。

初始化数组时,将复制元素。更多的"直接"支撑仪似乎在这里起作用:

CrossSpectrum XS[numOfFFT] = {
    { frameLen, SIGLIB_HANNING },
    { frameLen, SIGLIB_HANNING }};

相关内容

  • 没有找到相关文章

最新更新