Linker 如何在Windows 8上正确链接libnfc?

Linker 如何在Windows 8上正确链接libnfc?,linker,nfc,dllimport,Linker,Nfc,Dllimport,我已经成功地编译了libnfc,并且所有的例子都很有效。现在,我正试图亲自编译其中一个示例,以了解如何做到这一点 我要编译的文件与libnfc self位于不同的文件夹中。编译时,它会给我以下错误(和警告): 这些函数在nfc UTIL中定义。我想这些也被编译进了dll?我已经将内容为nfc utils.c和.h的文件夹utils放在同一个文件夹中,但这也不会有帮助 test.c文件的内容与nfc anticol.c文件的内容相同 有什么建议吗?好的,我自己找到的 我显然忘记了在gcc-c步骤中

我已经成功地编译了libnfc,并且所有的例子都很有效。现在,我正试图亲自编译其中一个示例,以了解如何做到这一点

我要编译的文件与libnfc self位于不同的文件夹中。编译时,它会给我以下错误(和警告):

这些函数在nfc UTIL中定义。我想这些也被编译进了dll?我已经将内容为nfc utils.c和.h的文件夹utils放在同一个文件夹中,但这也不会有帮助

test.c文件的内容与nfc anticol.c文件的内容相同

有什么建议吗?

好的,我自己找到的

我显然忘记了在gcc-c步骤中编译utils/nfc utils.c和test.c。 分两步完成并找到了它

C:\thesis\libnfc\dev>gcc -m32 test.c utils/nfc-utils.c -c
In file included from test.c:48:0:
utils/nfc-utils.h:97:14: warning: 'str_nfc_baud_rate' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
In file included from utils/nfc-utils.c:37:0:
utils/nfc-utils.h:97:14: warning: 'str_nfc_baud_rate' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]

C:\thesis\libnfc\dev>gcc -m32 test.o nfc-utils.o -o test -L"C:\thesis\libnfc\libnfc-build\libnfc" -lnfc
这给出了两个警告,但当我运行它时,它起作用了

C:\thesis\libnfc\dev>gcc -m32 test.c utils/nfc-utils.c -c
In file included from test.c:48:0:
utils/nfc-utils.h:97:14: warning: 'str_nfc_baud_rate' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
In file included from utils/nfc-utils.c:37:0:
utils/nfc-utils.h:97:14: warning: 'str_nfc_baud_rate' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]

C:\thesis\libnfc\dev>gcc -m32 test.o nfc-utils.o -o test -L"C:\thesis\libnfc\libnfc-build\libnfc" -lnfc