LNK2019: unresolved external symbol __imp_fftw_execute referenced in function "private: virtual void __cdecl QFFT::run(void)"
-
I'm using FFTW in my project. it works with MinGW perfectly but now I want to change my compiler to MSVC (2019). so first I make .lib files according to this. then I add
LIBS += -L "C:\fftw\fftw-3.3.5-dll64" -lfftw3-3 INCLUDEPATH += "C:\fftw\fftw-3.3.5-dll64"
to my .pro but after compilation this error occurred:
error: LNK2019: unresolved external symbol __imp_fftw_execute referenced in function "private: virtual void __cdecl QFFT::run(void)" (?run@QFFT@@EEAAXXZ)
QFFT is my internal class and FFTW functions called in run function.
I think it cannot find the library file. what is the problem? Also I use "Add Library" to import this lib to my project but the error doesn't changed:win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../fftw/fftw-3.3.5-dll64/ -lfftw3-3 else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../fftw/fftw-3.3.5-dll64/ -lfftw3-3d else:unix: LIBS += -L$$PWD/../../../../../../fftw/fftw-3.3.5-dll64/ -lfftw3-3 INCLUDEPATH += $$PWD/../../../../../../fftw/fftw-3.3.5-dll64 DEPENDPATH += $$PWD/../../../../../../fftw/fftw-3.3.5-dll64
FFTW directory in my PC:
-
@vakh
I don't know exactly what your problem is, but I do not think it is that it cannot find a library, you should get a different message for that I think (try commenting out yourLIBS += ...
line and see what error you then get), rather there is an issue in how it was compiled/linked. Maybe go look at howQFFT::run()
referencesfftw_execute()
and how the latter is defined. I will say that the code looks like it is over a decade old and was last tested against VS 2010. -
@vakh said in LNK2019: unresolved external symbol __imp_fftw_execute referenced in function "private: virtual void __cdecl QFFT::run(void)":
I'm using FFTW in my project. it works with MinGW perfectly but now I want to change my compiler to MSVC (2019). so first I make .lib files according to this. then I add
LIBS += -L "C:\fftw\fftw-3.3.5-dll64" -lfftw3-3
INCLUDEPATH += "C:\fftw\fftw-3.3.5-dll64"Try removing the space following
-L
If that fails post the entire set of linker command leading up to this failure.
-
@JonB I commented INCLUDEPATH and LIBS and seen same error messages:
error: LNK2019: unresolved external symbol __imp_fftw_execute referenced in function "private: virtual void __cdecl QFFT::run(void)" (?run@QFFT@@EEAAXXZ) error: LNK2019: unresolved external symbol __imp_fftw_plan_dft_1d referenced in function "private: virtual void __cdecl QFFT::run(void)" (?run@QFFT@@EEAAXXZ) error: LNK2019: unresolved external symbol __imp_fftw_destroy_plan referenced in function "private: virtual void __cdecl QFFT::run(void)" (?run@QFFT@@EEAAXXZ) error: LNK2019: unresolved external symbol __imp_fftw_alloc_complex referenced in function "private: virtual void __cdecl QFFT::run(void)" (?run@QFFT@@EEAAXXZ) error: LNK2019: unresolved external symbol __imp_fftw_free referenced in function "private: virtual void __cdecl QFFT::run(void)" (?run@QFFT@@EEAAXXZ)
It works properly with MinGW and it must works with MSVC too. so I think QFFT::run(void) is OK.
-
the problem was wrong changing name. after using lib.exe to convert libfftw3f-3.dll to libfftw3f-3.lib. after this I changed the libfftw3f-3.lib to fftw3f-3.lib to detected by QT. but it's wrong. the name must not changed and I used this in my .pro file.
# MinGW #INCLUDEPATH += "c:\fftw\fftw-3.3.5-dll64" #LIBS += -L "C:\fftw\fftw-3.3.5-dll64" -lfftw3-3 # MSVC INCLUDEPATH += "c:\fftw\fftw-3.3.5-dll64" LIBS += -L"C:\fftw\fftw-3.3.5-dll64" -llibfftw3-3
and now my FFTW folder contains these files:
-