[cs13001] about lab 8

Mikhail Nesterenko mikhail at cs.kent.edu
Fri Mar 8 10:30:51 EST 2013


These are linker errors. The linker could not find definitions for the
function invocations. In your case it is operational(), printFleet(),
printShip() and check() invoked in main().

The most common reason for this error is incorrect parameter
types. For example, your function prototype/definition requires an
array of structures and you invoke it with just a single structure; it
requires location and you invoke it with integer.

Other reasons may be that you forgot to include the header file or did
not provide function definitions at all.

Thanks,
--
Mikhail


> 
> I met some problems when I debug my lab 8 code, it shows me that
> 
> 1>Battleship_guessing_game.obj : error LNK2019: unresolved external symbol
> "bool __cdecl operational(struct ship const * const)" (
> ?operational@@YA_NQBUship@@@Z) referenced in function _main
> 1>Battleship_guessing_game.obj : error LNK2019: unresolved external symbol
> "void __cdecl printFleet(struct ship const * const)" (
> ?printFleet@@YAXQBUship@@@Z) referenced in function _main
> 1>Battleship_guessing_game.obj : error LNK2019: unresolved external symbol
> "void __cdecl printShip(struct ship)" (?printShip@@YAXUship@@@Z) referenced
> in function _main
> 1>Battleship_guessing_game.obj : error LNK2019: unresolved external symbol
> "int __cdecl check(struct ship const * const,struct location)" (
> ?check@@YAHQBUship@@Ulocation@@@Z) referenced in function _main
> 1>C:\Users\Keown\Documents\Visual Studio
> 2010\Projects\Lab8_Battleship\Debug\Lab8_Battleship.exe : fatal error
> LNK1120: 4 unresolved externals
> I have no idea why it will happen and how to fix it.


More information about the cs13001 mailing list