2

I'm using Visual Studio 2012 on a 64-bit operating system. I'm trying to use FFTW in a program, but having problems getting the libraries to link.

I downloaded the 64-bit package from the FFTW Windows page. I followed these steps:

  • lib /machine:x64 /def:libfftw3-3.def
  • lib /machine:x64 /def:libfftw3f-3.def
  • lib /machine:x64 /def:libfftw3l-3.def

This created the .exp and .lib files.

I added the path with all of the files in:

Properties -> Debugging -> Environment Properties -> VC++ Directories -> Include Directories Properties -> C/C++ -> General -> Additional Include Directories Properties -> Linker -> General -> Additional Library Directories

I added the .lib files to Properties -> Linker -> Input -> Additional Dependencies

I added the following lines to the top of my code:

#define FFTW_DLL
#include <fftw3.h>

then I put the sample code from the FFTW tutorial into my code, like so:

fftw_complex *in; 
fftw_complex *out;

fftw_plan p;

in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*L);
out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*L);
p = fftw_plan_dft_1d(L, in, out,FFTW_FORWARD,FFTW_MEASURE); 

fftw_execute(p);
fftw_destroy_plan(p);
fftw_free(in);
fftw_free(out);

When I then try to build my application, I get the following error:

Error   1   error LNK2019: unresolved external symbol __imp__fftw_execute referenced in function _wmain C:\EEG_Hardware\source\dspApp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj   1   1   ConsoleApplication1
Error   2   error LNK2019: unresolved external symbol __imp__fftw_plan_dft_1d referenced in function _wmain C:\EEG_Hardware\source\dspApp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj   1   1   ConsoleApplication1
Error   3   error LNK2019: unresolved external symbol __imp__fftw_destroy_plan referenced in function _wmain    C:\EEG_Hardware\source\dspApp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj   1   1   ConsoleApplication1
Error   4   error LNK2019: unresolved external symbol __imp__fftw_malloc referenced in function _wmain  C:\EEG_Hardware\source\dspApp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj   1   1   ConsoleApplication1
Error   5   error LNK2019: unresolved external symbol __imp__fftw_free referenced in function _wmain    C:\EEG_Hardware\source\dspApp\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj   1   1   ConsoleApplication1
Error   6   error LNK1120: 5 unresolved externals   C:\EEG_Hardware\source\dspApp\ConsoleApplication1\Debug\ConsoleApplication1.exe ConsoleApplication1

I've been searching through this site, trying any solution I can find, but so far no luck. Any assistance would be greatly appreciated!

4

1 回答 1

0

我也使用了您的程序,但它对我也没有完全起作用。

我通过在生成 .exp 和 .lib 文件之前复制这些文件来修改该过程

msobj100.dll
mspdb100.dll
mspdbcore.dll
mspdbsrv.exe

您可以在 C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE 目录中找到。

另外,我最后将三个 .dll 文件复制到了 .vcxproj 和 .vcxproj.filters 所在项目的文件夹中。

于 2013-02-16T15:18:22.463 回答