1

I'm working with a project made professionally by someone else, so the code should be bug-free. The problems I'm having with it is most likely to do with the project configurations.

The project I'm trying to compile has C and C++ source files kept within the following folders, all within the project directory: Hardware, Header Files, Source Files, TCP/IP, uTasker and WinSim. When I attempt to compile, it returns the following build log:

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 is kept within the Hardware/LPC17XX folder.

WinSim.c and WinSimMain.cpp are kept within the WinSim folder.

I'm not sure how to configure my linker to fix these problems, any help would be appreciated.

Edit: I'm using Visual Studio 2010 to build the project.

WhozCraig
  • 65,258
  • 11
  • 75
  • 141
Tagc
  • 8,736
  • 7
  • 61
  • 114
  • 1
    You need to link against the WinPcap library. On the command line, you'd do this by adding the library name (e.g. winpcap.lib) as part of the `link` command. In Visual Studio, you'll have to hunt around project config dialogs to find the linker settings. – simonc Dec 28 '12 at 11:28
  • 3
    Does [this question](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) give you any ideas on solving this? – WhozCraig Dec 28 '12 at 11:28
  • Incredible question, @WhozCraig – Adri C.S. Dec 28 '12 at 11:36
  • @simonc I checked in "Additional Dependencies" for the linker input and found wpcap.lib which sounds like the appropriate library. I'm not sure where to go from here. Under "Additional Library Directories" I found the path to wpcap.lib too. – Tagc Dec 28 '12 at 11:43
  • Luchian was a *machine* in writing that question and the posted answers up. Props to him. – WhozCraig Dec 28 '12 at 11:51
  • Certainly pretty awesome of him to provide all that information. I think the most relevant of all of those for me is the one at the bottom under "Failure to link against appropriate libraries/object files or compile implementation files", which is also what simonc is saying, but as far as I can tell, the library config is already setup correctly. – Tagc Dec 28 '12 at 12:03
  • 1
    I can't even *find* documentation on the functions listed here as link-missing. I'm assuming you hit all the highlights of [the winpcap usage documentation](http://www.winpcap.org/docs/docs_412/html/group__wpcapsamps.html), including the proper preprocessor directives, etc ? – WhozCraig Dec 28 '12 at 12:09
  • Will do. *very* glad you're up and running. The latest docs I could find were on VS2005 setup, but hopefully they're still accurate enough to get you through your current task. – WhozCraig Dec 28 '12 at 12:32

1 Answers1

1

The documentation on WinPCap is a little out of date from what I've been able to find, but there are some pretty important setup instructions, particularly the pre-processor macros that should be defined to get things properly setup for a good link.

The latest setup docs I could find are here. I hope they help get you going.

Alan
  • 3,715
  • 3
  • 39
  • 57
WhozCraig
  • 65,258
  • 11
  • 75
  • 141