views:

52

answers:

2

I would like to use FFTW3 on Windows-64 bit. I follow the instructions on FFTW website: download the package, unzip, run lib.exe to create .lib "import libraries".

After doing so, I build my application (which runs just fine using FFTW3 dlls 32-bit) and I get the following errors:

1>pyramidTransform.obj : error LNK2019: unresolved external symbol __imp_fftw_destroy_plan referenced in function "int __cdecl fourier2spatialband1(int,int,float *,float ,double ()[2],double ()[2],double ()[2])" (?fourier2spatialband1@@YAHHHPEAM0PEAY01N11@Z) 1>pyramidTransform.obj : error LNK2019: unresolved external symbol __imp_fftw_execute referenced in function "int __cdecl fourier2spatialband1(int,int,float *,float ,double ()[2],double ()[2],double ()[2])" (?fourier2spatialband1@@YAHHHPEAM0PEAY01N11@Z) 1>pyramidTransform.obj : error LNK2019: unresolved external symbol __imp_fftw_plan_dft_2d referenced in function "int __cdecl fourier2spatialband1(int,int,float *,float ,double ()[2],double ()[2],double ()[2])" (?fourier2spatialband1@@YAHHHPEAM0PEAY01N11@Z) 1>pyramidTransform.obj : error LNK2019: unresolved external symbol __imp_fftw_free referenced in function "int __cdecl decompose(int,int,float *,int,int,float * *,float * *,float *,float * * *,float * * *,float * *,float * *)" (?decompose@@YAHHHPEAMHHPEAPEAM10PEAPEAPEAM211@Z) 1>pyramidTransform.obj : error LNK2019: unresolved external symbol __imp_fftw_malloc referenced in function "int __cdecl decompose(int,int,float *,int,int,float * *,float * *,float *,float * * *,float * * *,float * *,float * *)" (?decompose@@YAHHHPEAMHHPEAPEAM10PEAPEAPEAM211@Z)

The property pane for Additional Dependencies clearly shows that I am linking to libfftw3-3.lib (created above).

How can I tell what Visual Studio trying to link to? Has anyone have any luck with FFTW-3 in Windows 64-bit?

+1  A: 

You are linking against the 64-bit version of the libraries, no? You said that it runs fine with the FFTW3 32-bits DLLs, so it sounds like you are using 32-bit libraries. 64-bit builds cannot link against a 32-bit library (or a 32-bit DLL for that matter).

In silico
I am linking against a 64-bit version which is downloaded into a separate folder.My 32-bit application was linked to the 32-bit dlls. I am quite sure that I am linking to a 64-bit dll for fftw3. If you have a tool that can verify this, I would be interest to learn.
Dat Chu
Are you sure? Set the linker to verbose mode (`Project -> Properties -> Linker -> Command Line -> Type in "/VERBOSE" into the Additional Options box.`) and see what libraries the linker is actually searching.
In silico
I put in the flag and the linker clearly searched the "supposingly right" lib file. How do I know that this lib file is any good? (i.e. 64-bit and have those symbols defined with the right name mangling?)
Dat Chu
A: 

I found the problem. With FFTW3, since the authors have already compiled the DLLs for Windows, you need to create import libraries (.lib) files from the supplied .def files. You do so by going to the Visual Studio 2008 command prompt:

lib /def:libfftw3-3.def

Microsoft (R) Library Manager Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved.

LINK : warning LNK4068: /MACHINE not specified; defaulting to X64
Creating library libfftw3f-3.lib and object libfftw3f-3.exp

The problem was that I must have started the wrong command prompt when I first created these .lib files.

More instructions can be found at FFTW Windows website.

Dat Chu