2012-12-28 88 views
1

我正在與其他人專業製作的項目合作,所以代碼應該沒有錯誤。我遇到的問題很可能與項目配置有關。WinPCap設置給出「無法解析的外部符號」鏈接器錯誤

我正在編譯的項目中,C和C++源文件保存在以下文件夾中,全部位於項目目錄中:硬件,頭文件,源文件,TCP/IP,uTasker和WinSim。當我嘗試編譯時,它返回以下生成日誌:

1>------ Build started: Project: uTasker, Configuration: Debug Win32 ------ 
1>LPC17XX.obj : error LNK2019: unresolved external symbol _fnOpenDefaultHostAdapter referenced in function _fnConfigEthernet 
1>WinSim.obj : error LNK2001: unresolved external symbol _iWinPcapSending 
1>WinSim.obj : error LNK2019: unresolved external symbol _fnWinPcapSendPkt referenced in function _fnSimulateEthTx 
1>WinSimMain.obj : error LNK2019: unresolved external symbol "void __cdecl fnDoEthereal(int,char *)" ([email protected]@[email protected]) referenced in function [email protected] 
1>WinSimMain.obj : error LNK2001: unresolved external symbol "int iTxActivity" ([email protected]@3HA) 
1>WinSimMain.obj : error LNK2001: unresolved external symbol "int iRxActivity" ([email protected]@3HA) 
1>WinSimMain.obj : error LNK2019: unresolved external symbol "void __cdecl fnWinPcapStopLink(struct HWND__ *)" ([email protected]@[email protected]@@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" ([email protected]@[email protected]@[email protected]) 
1>WinSimMain.obj : error LNK2019: unresolved external symbol "void __cdecl fnWinPcapSelectLAN(int)" ([email protected]@[email protected]) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" ([email protected]@[email protected]@[email protected]) 
1>WinSimMain.obj : error LNK2019: unresolved external symbol "void __cdecl fnWinPcapOpenAdapter(void)" ([email protected]@YAXXZ) referenced in function "long __stdcall SetNIC(struct HWND__ *,unsigned int,unsigned int,long)" ([email protected]@[email protected]@[email protected]) 
1>WinSimMain.obj : error LNK2019: unresolved external symbol "void __cdecl fnWinPcapClose(void)" ([email protected]@YAXXZ) referenced in function "long __stdcall SetNIC(struct HWND__ *,unsigned int,unsigned int,long)" ([email protected]@[email protected]@[email protected]) 
1>WinSimMain.obj : error LNK2019: unresolved external symbol "int __cdecl fnShowNICs(struct HWND__ *)" ([email protected]@[email protected]@@Z) referenced in function "long __stdcall SetNIC(struct HWND__ *,unsigned int,unsigned int,long)" ([email protected]@[email protected]@[email protected]) 
1>.\Debug\uTasker.exe : fatal error LNK1120: 11 unresolved externals 

LPC17XX.c保存在Hardware/LPC17XX文件夾中。

WinSim.c和WinSimMain.cpp保存在WinSim文件夾中。

我不知道如何配置我的鏈接器來解決這些問題,任何幫助將不勝感激。

編輯:我正在使用Visual Studio 2010來構建項目。

+1

您需要鏈接到WinPcap庫。在命令行中,您可以通過添加庫名稱(例如winpcap.lib)作爲「link」命令的一部分來完成此操作。在Visual Studio中,您將不得不圍繞項目配置對話框尋找鏈接器設置。 – simonc

+3

[這個問題](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-doi-i-fix)給你任何解決這個問題的想法? – WhozCraig

+0

令人難以置信的問題,@WhozCraig –

回答

1

WinPCap上的文檔與我所能找到的有點過時,但是有一些非常重要的設置說明,特別是應該定義的預處理器宏,以便正確設置良好的聯繫。

我能找到的最新設置文檔是here。我希望他們幫助你走。

相關問題