您好,我最近学习 Qt示例程序——Spectrum Analyzer中的源代码。因为牵扯到库的知识我不熟悉,所以想修改一下使它不涉及到库。源代码基本不变。
我们看一下修改后的pro文件。
- #-------------------------------------------------
- #
- # 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
运行一下。
有类似的错误提示
- D:\Qt\myspectrum-build-desktop/../myspectrum/spectrumanalyser.cpp:71: 错误:undefined reference to `_imp___ZN14FFTRealWrapperC1Ev'
因为不使用库,打开 fftreal_wrapper.h。
将:
- #if defined(FFTREAL_LIBRARY)
- # define FFTREAL_EXPORT Q_DECL_EXPORT
- //# define FFTREAL_EXPORT
- #else
- # define FFTREAL_EXPORT Q_DECL_IMPORT
- //# define FFTREAL_EXPORT
- #endif
修改为
- #if defined(FFTREAL_LIBRARY)
- //# define FFTREAL_EXPORT Q_DECL_EXPORT
- # define FFTREAL_EXPORT
- #else
- //# define FFTREAL_EXPORT Q_DECL_IMPORT
- # define FFTREAL_EXPORT
- #endif
运行一下,通过。
谢谢你的阅读。