尝试在64位Windows 7操作系统上构建libnfc-1.6.0-rc1时,我收到了未定义的引用错误。
我正在使用以下依赖项:
从cmake-gui
命令成功生成输出后,执行mingw32-make VERBOSE=1
命令时出现以下错误:
D:\libNFC\libnfc-build 1>mingw32-make VERBOSE=1
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -H"D:\libNFC\libnfc-1.6.0-rc1" -B"D:\libNFC\libnfc-build 1" --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_start "D:\libNFC\libnfc-build 1\CMakeFiles" "D:\libNFC\libnfc-build 1\CMakeFiles\progress.marks"
mingw32-make -f CMakeFiles\Makefile2 all
mingw32-make[1]: Entering directory `D:/Software development/nfc/libnfc.org/libnfc-build 1'
mingw32-make -f libnfc\CMakeFiles\nfc.dir\build.make libnfc/CMakeFiles/nfc.dir/depend
mingw32-make[2]: Entering directory `D:/Software development/nfc/libnfc.org/libnfc-build 1'
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" "D:\libNFC\libnfc-1.6.0-rc1" "D:\libNFC\libnfc-1.6.0-rc1\libnfc" "D:\libNFC\libnfc-build 1" "D:\libNFC\libnfc-build 1\libnfc" "D:\libNFC\libnfc-build 1\libnfc\CMakeFiles\nfc.dir\DependInfo.cmake" --color=Dependee "D:\libNFC\libnfc-build 1\libnfc\CMakeFiles\nfc.dir\DependInfo.cmake" is newer than depender "D:/Software development/nfc/libnfc.org/libnfc-build 1/libnfc/CMakeFiles/nfc.dir/depend.internal".
Dependee "D:/Software development/nfc/libnfc.org/libnfc-build 1/libnfc/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "D:/Software development/nfc/libnfc.org/libnfc-build 1/libnfc/CMakeFiles/nfc.dir/depend.internal".
Scanning dependencies of target nfc
mingw32-make[2]: Leaving directory `D:/Software development/nfc/libnfc.org/libnfc-build 1'
mingw32-make -f libnfc\CMakeFiles\nfc.dir\build.make libnfc/CMakeFiles/nfc.dir/build
mingw32-make[2]: Entering directory `D:/Software development/nfc/libnfc.org/libnfc-build 1'
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 1
[ 3%] Building C object libnfc/CMakeFiles/nfc.dir/nfc.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\nfc.c.obj
-c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\nfc.c"
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 2
[ 6%] Building C object libnfc/CMakeFiles/nfc.dir/nfc-device.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\nfc-device.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\nfc-device.c"
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 3
[ 10%] Building C object libnfc/CMakeFiles/nfc.dir/nfc-emulation.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\nfc-emulation.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\nfc-emulation.c"
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 4
[ 13%] Building C object libnfc/CMakeFiles/nfc.dir/nfc-internal.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\nfc-internal.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\nfc-internal.c"
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 5
[ 16%] Building C object libnfc/CMakeFiles/nfc.dir/iso14443-subr.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\iso14443-subr.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\iso14443-subr.c"
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 6
[ 20%] Building C object libnfc/CMakeFiles/nfc.dir/mirror-subr.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\mirror-subr.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\mirror-subr.c"
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 7
[ 23%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/acr122.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\drivers\acr122.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\drivers\acr122.c"
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 8
[ 26%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/pn53x_usb.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\drivers\pn53x_usb.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\drivers\pn53x_usb.c"
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 9
[ 30%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/arygon.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\drivers\arygon.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\drivers\arygon.c"
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 10
[ 33%] Building C object libnfc/CMakeFiles/nfc.dir/buses/uart.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\buses\uart.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\buses\uart.c"
In file included from D:\libNFC\libnfc-1.6.0-rc1\libnfc\buses\uart.c:41:0:
D:\libNFC\libnfc-1.6.0-rc1\libnfc\buses\uart_win32.c: In function 'uart_receive':
D:\libNFC\libnfc-1.6.0-rc1\libnfc\buses\uart_win32.c:159:87: warning: ISO C99 requires rest arguments to be used [enabled by default]
D:\libNFC\libnfc-1.6.0-rc1\libnfc\buses\uart_win32.c:168:58: warning: ISO C99 requires rest arguments to be used [enabled by default]
In file included from D:/Software development/nfc/libnfc.org/libnfc-1.6.0-rc1/contrib/windows.h:31:0,
from D:/Software development/nfc/libnfc.org/libnfc-1.6.0-rc1/config.h:1,
from D:\libNFC\libnfc-1.6.0-rc1\libnfc\buses\uart.c:27:
D:/Software development/nfc/libnfc.org/libnfc-1.6.0-rc1/contrib/win32/err.h:17:13: warning: unused variable 'errx' [-Wunused-variable]
In file included from D:\libNFC\libnfc-1.6.0-rc1\libnfc\buses\uart.c:41:0:
D:\libNFC\libnfc-1.6.0-rc1\libnfc\buses\uart_win32.c: In function 'uart_send':
D:\libNFC\libnfc-1.6.0-rc1\libnfc\buses\uart_win32.c:209:87: warning: ISO C99 requires rest arguments to be used [enabled by default]
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "D:\libNFC\libnfc-build 1\CMakeFiles" 11
[ 36%] Building C object libnfc/CMakeFiles/nfc.dir/chips/pn53x.c.obj
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && c:\MinGW64\bin\gcc.exe -DDRIVER_ACR122_ENABLED -DDRIVER_ARYGON_ENABLED -DDRIVER_PN53X_USB_ENABLED -DHAVE_CONFIG_H -Dnfc_EXPORTS -Du_int16_t=uint16_t -Du_int8_t=uint8_t @CMakeFiles/nfc.dir/includes_C.rsp -Wall -pedantic -std=c99 -m32 -o CMakeFiles\nfc.dir\chips\pn53x.c.obj -c "D:\libNFC\libnfc-1.6.0-rc1\libnfc\chips\pn53x.c"
Linking C shared library libnfc.dll
cd /d D:\SOFTWA~1\nfc\libnfc.org\LIBNFC~2\libnfc && "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_link_script CMakeFiles\nfc.dir\link.txt --verbose=1
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E remove -f CMakeFiles\nfc.dir/objects.a
c:\MinGW64\bin\ar.exe cr CMakeFiles\nfc.dir/objects.a @CMakeFiles\nfc.dir\objects1.rsp
c:\MinGW64\bin\gcc.exe -m32 -shared -o libnfc.dll -Wl,--out-implib,libnfc.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles\nfc.dir/objects.a -Wl,--no-whole-archive c:\MinGW64\x86_64-w64-mingw32\lib32\libwinscard.a "D:\Software development\usb\libusb\libusb-win32-bin-1.2.6.0\lib\msvc_x64\libusb.lib" -lwsock32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x31): undefined reference to `usb_bulk_read'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x72): undefined reference to `usb_bulk_write'
:::
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x9f2): undefined reference to `usb_close'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj): bad relocaddress 0x4c in section `.rdata'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [libnfc/libnfc.dll] Error 1
mingw32-make[2]: Leaving directory `D:/Software development/nfc/libnfc.org/libnfc-build 1'
mingw32-make[1]: *** [libnfc/CMakeFiles/nfc.dir/all] Error 2
mingw32-make[1]: Leaving directory `D:/Software development/nfc/libnfc.org/libnfc-build 1'
mingw32-make: *** [all] Error 2
可能是什么问题?谁能帮助。我是NFC开发的新手,您的及时帮助非常有帮助。
答案 0 :(得分:1)
而不是..\msvc_x64\libusb.lib
,尝试在cmake-gui配置中使用..\msvc\libusb.lib
,然后生成。
答案 1 :(得分:0)
这是我在windows上运行acr122和libnfc的解决方案:
https://huseyincakir.wordpress.com/2014/12/02/libnfc-with-acr122-on-windows-8-1/