我正在处理一个由其他人专业制作的项目,因此代码应该没有错误。我遇到的问题很可能与项目配置有关。
我正在尝试编译的项目有 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 *)" (?fnDoEthereal@@YAXHPAD@Z) referenced in function _WinMain@16
1>WinSimMain.obj : error LNK2001: unresolved external symbol "int iTxActivity" (?iTxActivity@@3HA)
1>WinSimMain.obj : error LNK2001: unresolved external symbol "int iRxActivity" (?iRxActivity@@3HA)
1>WinSimMain.obj : error LNK2019: unresolved external symbol "void __cdecl fnWinPcapStopLink(struct HWND__ *)" (?fnWinPcapStopLink@@YAXPAUHWND__@@@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
1>WinSimMain.obj : error LNK2019: unresolved external symbol "void __cdecl fnWinPcapSelectLAN(int)" (?fnWinPcapSelectLAN@@YAXH@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
1>WinSimMain.obj : error LNK2019: unresolved external symbol "void __cdecl fnWinPcapOpenAdapter(void)" (?fnWinPcapOpenAdapter@@YAXXZ) referenced in function "long __stdcall SetNIC(struct HWND__ *,unsigned int,unsigned int,long)" (?SetNIC@@YGJPAUHWND__@@IIJ@Z)
1>WinSimMain.obj : error LNK2019: unresolved external symbol "void __cdecl fnWinPcapClose(void)" (?fnWinPcapClose@@YAXXZ) referenced in function "long __stdcall SetNIC(struct HWND__ *,unsigned int,unsigned int,long)" (?SetNIC@@YGJPAUHWND__@@IIJ@Z)
1>WinSimMain.obj : error LNK2019: unresolved external symbol "int __cdecl fnShowNICs(struct HWND__ *)" (?fnShowNICs@@YAHPAUHWND__@@@Z) referenced in function "long __stdcall SetNIC(struct HWND__ *,unsigned int,unsigned int,long)" (?SetNIC@@YGJPAUHWND__@@IIJ@Z)
1>.\Debug\uTasker.exe : fatal error LNK1120: 11 unresolved externals
LPC17XX.c 保存在 Hardware/LPC17XX 文件夹中。
WinSim.c 和 WinSimMain.cpp 保存在 WinSim 文件夹中。
我不确定如何配置我的链接器来解决这些问题,任何帮助将不胜感激。
编辑:我正在使用 Visual Studio 2010 来构建项目。