您的位置:首页 > 编程语言 > Qt开发

修改的不使用库的Qt示例程序——Spectrum Analyzer

2016-02-22 13:07 1361 查看
  您好,我最近学习 Qt示例程序——Spectrum Analyzer中的源代码。因为牵扯到库的知识我不熟悉,所以想修改一下使它不涉及到库。源代码基本不变。

我们看一下修改后的pro文件。

[plain] view
plain copy

#-------------------------------------------------  

#  

# Project created by QtCreator 2006-11-01T00:15:55  

#  

#-------------------------------------------------  

  

#QT       += core gui  

QT       += multimedia  

  

TARGET = myspectrum  

TEMPLATE = app  

  

  

SOURCES += main.cpp\  

        engine.cpp \  

    frequencyspectrum.cpp \  

    levelmeter.cpp \  

    mainwidget.cpp \  

    progressbar.cpp \  

    settingsdialog.cpp \  

    spectrograph.cpp \  

    spectrumanalyser.cpp \  

    tonegenerator.cpp \  

    tonegeneratordialog.cpp \  

    utils.cpp \  

    waveform.cpp \  

    wavfile.cpp \  

    fftreal_wrapper.cpp  

  

HEADERS  += engine.h \  

    frequencyspectrum.h \  

    levelmeter.h \  

    mainwidget.h \  

    progressbar.h \  

    settingsdialog.h \  

    spectrograph.h \  

    spectrum.h \  

    spectrumanalyser.h \  

    tonegenerator.h \  

    tonegeneratordialog.h \  

    utils.h \  

    waveform.h \  

    wavfile.h \  

    fftreal_wrapper.h \  

    FFTRealFixLenParam.h \  

    FFTRealFixLen.h \  

    FFTRealFixLen.hpp \  

    Array.h \  

    Array.hpp \  

    DynArray.h \  

    DynArray.hpp \  

    OscSinCos.h \  

    OscSinCos.hpp \  

    def.h \  

    FFTRealPassDirect.h \  

    FFTRealPassDirect.hpp \  

    FFTRealUseTrigo.h \  

    FFTRealUseTrigo.hpp \  

    FFTRealPassInverse.h \  

    FFTRealPassInverse.hpp \  

    FFTRealSelect.h \  

    FFTRealSelect.hpp  

运行一下。

有类似的错误提示

[plain] view
plain copy

D:\Qt\myspectrum-build-desktop/../myspectrum/spectrumanalyser.cpp:71: 错误:undefined reference to `_imp___ZN14FFTRealWrapperC1Ev'  

因为不使用库,打开 fftreal_wrapper.h。

将:

[plain] view
plain copy

#if defined(FFTREAL_LIBRARY)  

#  define FFTREAL_EXPORT Q_DECL_EXPORT  

//#  define FFTREAL_EXPORT  

#else  

#  define FFTREAL_EXPORT Q_DECL_IMPORT  

//#  define FFTREAL_EXPORT  

#endif  

修改为

[plain] view
plain copy

#if defined(FFTREAL_LIBRARY)  

//#  define FFTREAL_EXPORT Q_DECL_EXPORT  

#  define FFTREAL_EXPORT  

#else  

//#  define FFTREAL_EXPORT Q_DECL_IMPORT  

#  define FFTREAL_EXPORT  

#endif  

运行一下,通过。

谢谢你的阅读。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: