fftw Visual Studio 2010编译静态库LNK2001错误__imp_fftwf

时间:2015-10-02 12:31:08

标签: visual-studio-2010 fftw

我成功编译了64位版本的fftw 3.3.4库作为静态库,其源代码和来自“fftw-3.3-libs-visual-studio-2010.zip”的Visual Studio解决方案。 现在我尝试链接到我使用fftw的项目中的静态库。 在构建/链接期间,我得到LNK2001错误

Fehler  30  error LNK2001: Nicht aufgelöstes externes Symbol "__imp_fftwf_malloc"

Sry,我有一个德国Visual Studio安装。基本上它说有一个名为“__imp_fftwf_malloc”的未解析符号。我为所有调用的fftw函数都收到此错误,并且在函数名称前面总是有“__imp_”。

我已经链接到库和/ verbose:lib告诉我库已成功搜索。 有没有人知道问题可能在哪里?

EDIT1: 我在我创建的库上做了一个dumpbin并复制了所有提到fftw_malloc的条目,也许这有用吗?

public symbol
A57BF4 fftwf_malloc
25B fftwf_malloc

Linker Directives
-----------------
/DEFAULTLIB:"libcpmtd"
/DEFAULTLIB:"LIBCMTD"
/DEFAULTLIB:"OLDNAMES"
/DEFAULTLIB:"VCOMPD"
/EXPORT:fftwf_malloc
/EXPORT:fftwf_free
/EXPORT:fftwf_alloc_real
/EXPORT:fftwf_alloc_complex

RELOCATIONS #2
                                            Symbol    Symbol
  Offset    Type              Applied To         Index     Name
 --------  ----------------  -----------------  --------  ------
 00000570  SECREL                     00000000         7  fftwf_malloc
 00000574  SECTION                        0000         7  fftwf_malloc
 000005C0  SECREL                     00000000         7  fftwf_malloc
 000005C4  SECTION                        0000         7  fftwf_malloc

RELOCATIONS #3
                                            Symbol    Symbol
 Offset    Type              Applied To         Index     Name
 --------  ----------------  -----------------  --------  ------
 00000024  REL32                      00000000         E  fftwf_kernel_malloc
 00000064  REL32                      00000000        1B  fftwf_kernel_free
 000000AB  REL32                      00000000         7  fftwf_malloc
 000000EB  REL32                      00000000         7  fftwf_malloc

COFF SYMBOL TABLE
000 00AA766F ABS    notype       Static       | @comp.id
001 00000000 SECT1  notype       Static       | .drectve
    Section length   B9, #relocs    0, #linenums    0, checksum        0
003 00000000 SECT2  notype       Static       | .debug$S
    Section length 1194, #relocs   10, #linenums    0, checksum        0
005 00000000 SECT3  notype       Static       | .text
    Section length   F5, #relocs    4, #linenums    0, checksum 50F0AACD
007 00000000 SECT3  notype ()    External     | fftwf_malloc
008 00000000 SECT4  notype       Static       | .pdata
    Section length   30, #relocs    C, #linenums    0, checksum BFE4C30B
00A 00000000 SECT4  notype       Static       | $pdata$fftwf_malloc
00B 00000000 SECT5  notype       Static       | .xdata

1 个答案:

答案 0 :(得分:1)

我刚遇到同样的问题。我使用visual studio 2017和fftw-3.3-libs-visual-studio-2010.zip和最新的fftw 3.6源文件来编译fftw3静态库。它已成功编译,但链接阶段的所有fftw函数都返回了LNK2001错误。

经过一些实验,我找到了原因。 您应该将fftw3.h包含在源文件中(在api文件夹下),而不是在分布式dll(windows预编译二进制文件)文件夹中。

然后fftw static lib成功链接。

注意:在此之后,您应该相应地更改/ MT或/ MTd与项目中的配置相同。