Visual Studio中的PCAP程序

时间:2015-05-30 18:37:15

标签: visual-studio-2010 pcap winpcap

以下是我在尝试执行PCAP程序从Visual Studio中的AirPCap Adapter获取MAC地址时遇到的错误。

1>------ Build started: Project: qqq, Configuration: Release Win32 ------
1>Build started 5/30/2015 2:38:23 PM.
1>InitializeBuildStatus:
1>  Touching "Release\qqq.unsuccessfulbuild".
1>ClCompile:
1>  test1.c
1>test1.obj : error LNK2001: unresolved external symbol _PacketGetVersion
1>test1.obj : error LNK2001: unresolved external symbol _PacketRequest
1>test1.obj : error LNK2001: unresolved external symbol _PacketCloseAdapter
1>test1.obj : error LNK2001: unresolved external symbol _PacketGetAdapterNames
1>test1.obj : error LNK2001: unresolved external symbol _PacketOpenAdapter
1>C:\Users\Sathwik\documents\visual studio 2010\Projects\qqq\Release\qqq.exe : fatal error LNK1120: 5 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.33
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

请帮我解决这些问题

以下是Linker Progress

1>------ Build started: Project: qqq, Configuration: Release Win32 ------
1>Build started 5/30/2015 4:31:40 PM.
1>InitializeBuildStatus:
1>  Touching "Release\qqq.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>Link:
1>  
1>  Starting pass 1
1>  Processed /DEFAULTLIB:uuid.lib
1>  Processed /DEFAULTLIB:MSVCRT
1>  Processed /DEFAULTLIB:OLDNAMES
1>  
1>  Searching libraries
1>      Searching C:\Users\Sathwik\Desktop\AirCap\developers\WinPcap_Devpack\Lib\wpcap.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\ws2_32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\kernel32.lib:
1>        Found __imp__GetLastError@0
1>          Referenced in test1.obj
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __IMPORT_DESCRIPTOR_KERNEL32
1>          Referenced in kernel32.lib(KERNEL32.dll)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __NULL_IMPORT_DESCRIPTOR
1>          Referenced in kernel32.lib(KERNEL32.dll)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found KERNEL32_NULL_THUNK_DATA
1>          Referenced in kernel32.lib(KERNEL32.dll)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\user32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\gdi32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\winspool.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\comdlg32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\advapi32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\shell32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\ole32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\oleaut32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\uuid.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\odbc32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\odbccp32.lib:
1>      Searching ..\..\..\..\..\Desktop\AirCap\developers\Airpcap_Devpack\lib\x64\airpcap.lib:
1>      Searching ..\..\..\..\..\Desktop\AirCap\developers\WinPcap_Devpack\Lib\x64\Packet.lib:
1>      Searching ..\..\..\..\..\Desktop\AirCap\developers\WinPcap_Devpack\Lib\x64\wpcap.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\MSVCRT.lib:
1>        Found @__security_check_cookie@4
1>          Referenced in test1.obj
1>          Loaded MSVCRT.lib(secchk.obj)
1>        Found __imp__free
1>          Referenced in test1.obj
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __imp__malloc
1>          Referenced in test1.obj
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __imp__scanf_s
1>          Referenced in test1.obj
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __imp__printf
1>          Referenced in test1.obj
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found _mainCRTStartup
1>          Loaded MSVCRT.lib(crtexe.obj)
1>        Found ___report_gsfailure
1>          Referenced in MSVCRT.lib(secchk.obj)
1>          Loaded MSVCRT.lib(gs_report.obj)
1>        Found ___security_cookie
1>          Referenced in MSVCRT.lib(secchk.obj)
1>          Referenced in MSVCRT.lib(gs_report.obj)
1>          Loaded MSVCRT.lib(gs_cookie.obj)
1>        Found __IMPORT_DESCRIPTOR_MSVCR100
1>          Referenced in MSVCRT.lib(MSVCR100.dll)
1>          Referenced in MSVCRT.lib(MSVCR100.dll)
1>          Referenced in MSVCRT.lib(MSVCR100.dll)
1>          Referenced in MSVCRT.lib(MSVCR100.dll)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found ___CxxSetUnhandledExceptionFilter
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(unhandld.obj)
1>        Found __amsg_exit
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __imp____getmainargs
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __dowildcard
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(wildcard.obj)
1>        Found __newmode
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(_newmode.obj)
1>        Found _atexit
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(atonexit.obj)
1>        Found __RTC_Terminate
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(_initsect_.obj)
1>        Found __imp___cexit
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __imp___exit
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __XcptFilter
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __imp__exit
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __imp____initenv
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __IsNonwritableInCurrentImage
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(pesect.obj)
1>        Found __initterm
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found ___xc_a
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(cinitexe.obj)
1>  Processed /DEFAULTLIB:kernel32.lib
1>   Processed /DISALLOWLIB:libcmt.lib
1>   Processed /DISALLOWLIB:libcmtd.lib
1>   Processed /DISALLOWLIB:msvcrtd.lib
1>        Found __initterm_e
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found ___native_startup_state
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(natstart.obj)
1>        Found __SEH_epilog4
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Referenced in MSVCRT.lib(atonexit.obj)
1>          Loaded MSVCRT.lib(sehprolg4.obj)
1>        Found __except_handler4
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Referenced in MSVCRT.lib(atonexit.obj)
1>          Referenced in MSVCRT.lib(pesect.obj)
1>          Referenced in MSVCRT.lib(sehprolg4.obj)
1>          Loaded MSVCRT.lib(chandler4gs.obj)
1>        Found __imp___configthreadlocale
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found ___globallocalestatus
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(xthdloc.obj)
1>        Found __setdefaultprecision
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(fp8.obj)
1>        Found __imp____setusermatherr
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __matherr
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(merr.obj)
1>        Found __setargv
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(dllargv.obj)
1>        Found __commode
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(xncommod.obj)
1>        Found __imp___commode
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __imp___fmode
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __fmode
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(xtxtmode.obj)
1>        Found __imp____set_app_type
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found ___security_init_cookie
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded MSVCRT.lib(gs_support.obj)
1>        Found __crt_debugger_hook
1>          Referenced in MSVCRT.lib(gs_report.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found MSVCR100_NULL_THUNK_DATA
1>          Referenced in MSVCRT.lib(MSVCR100.dll)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found "void __cdecl terminate(void)" (?terminate@@YAXXZ)
1>          Referenced in MSVCRT.lib(unhandld.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __unlock
1>          Referenced in MSVCRT.lib(atonexit.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found ___dllonexit
1>          Referenced in MSVCRT.lib(atonexit.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __lock
1>          Referenced in MSVCRT.lib(atonexit.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __imp___onexit
1>          Referenced in MSVCRT.lib(atonexit.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __except_handler4_common
1>          Referenced in MSVCRT.lib(chandler4gs.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __invoke_watson
1>          Referenced in MSVCRT.lib(fp8.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>        Found __controlfp_s
1>          Referenced in MSVCRT.lib(fp8.obj)
1>          Loaded MSVCRT.lib(MSVCR100.dll)
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Users\Sathwik\Desktop\AirCap\developers\WinPcap_Devpack\Lib\wpcap.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\ws2_32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\kernel32.lib:
1>        Found __imp__InterlockedExchange@8
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__Sleep@4
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__InterlockedCompareExchange@12
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__HeapSetInformation@16
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__EncodePointer@4
1>          Referenced in MSVCRT.lib(crtexe.obj)
1>          Referenced in MSVCRT.lib(atonexit.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__TerminateProcess@8
1>          Referenced in MSVCRT.lib(gs_report.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__GetCurrentProcess@0
1>          Referenced in MSVCRT.lib(gs_report.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__UnhandledExceptionFilter@4
1>          Referenced in MSVCRT.lib(gs_report.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__SetUnhandledExceptionFilter@4
1>          Referenced in MSVCRT.lib(gs_report.obj)
1>          Referenced in MSVCRT.lib(unhandld.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__IsDebuggerPresent@0
1>          Referenced in MSVCRT.lib(gs_report.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__DecodePointer@4
1>          Referenced in MSVCRT.lib(atonexit.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__QueryPerformanceCounter@4
1>          Referenced in MSVCRT.lib(gs_support.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__GetTickCount@0
1>          Referenced in MSVCRT.lib(gs_support.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__GetCurrentThreadId@0
1>          Referenced in MSVCRT.lib(gs_support.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__GetCurrentProcessId@0
1>          Referenced in MSVCRT.lib(gs_support.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>        Found __imp__GetSystemTimeAsFileTime@4
1>          Referenced in MSVCRT.lib(gs_support.obj)
1>          Loaded kernel32.lib(KERNEL32.dll)
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\user32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\gdi32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\winspool.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\comdlg32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\advapi32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\shell32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\ole32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\oleaut32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\uuid.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\odbc32.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\odbccp32.lib:
1>      Searching ..\..\..\..\..\Desktop\AirCap\developers\Airpcap_Devpack\lib\x64\airpcap.lib:
1>      Searching ..\..\..\..\..\Desktop\AirCap\developers\WinPcap_Devpack\Lib\x64\Packet.lib:
1>      Searching ..\..\..\..\..\Desktop\AirCap\developers\WinPcap_Devpack\Lib\x64\wpcap.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\MSVCRT.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Users\Sathwik\Desktop\AirCap\developers\WinPcap_Devpack\Lib\wpcap.lib:
1>      Searching c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\ws2_32.lib:
1>  
1>  Finished searching libraries
1>  
1>  Finished pass 1
1>  
1>test1.obj : error LNK2001: unresolved external symbol _PacketGetVersion
1>test1.obj : error LNK2001: unresolved external symbol _PacketRequest
1>test1.obj : error LNK2001: unresolved external symbol _PacketCloseAdapter
1>test1.obj : error LNK2001: unresolved external symbol _PacketGetAdapterNames
1>test1.obj : error LNK2001: unresolved external symbol _PacketOpenAdapter
1>C:\Users\Sathwik\documents\visual studio 2010\Projects\qqq\Release\qqq.exe : fatal error LNK1120: 5 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.10
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

enter image description here

新错误

'qqq.exe': Loaded 'C:\Users\Sathwik\Documents\Visual Studio 2010\Projects\qqq\Release\qqq.exe', Symbols loaded.
'qqq.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\Packet.dll', Cannot find or open the PDB file
'qqq.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\IPHLPAPI.DLL', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\winnsi.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\airpcap.dll', Cannot find or open the PDB file
'qqq.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\dhcpcsvc6.dll', Symbols loaded (source information stripped).
'qqq.exe': Loaded 'C:\Windows\SysWOW64\dhcpcsvc.dll', Symbols loaded (source information stripped).
The thread 'Win32 Thread' (0x23f0) has exited with code -1 (0xffffffff).
The program '[3532] qqq.exe: Native' has exited with code -1 (0xffffffff).

1 个答案:

答案 0 :(得分:1)

这些符号是winPcap库的一部分。您需要将您的计划与wpcap.lib相关联。请注意,如果要创建x86程序,则必须与x86库链接,x64也是如此。

您还需要确保在您的应用程序中部署DLL。

http://www.winpcap.org/docs/docs_412/html/group__wpcapsamps.html