Tuesday, July 28, 2009

C++ Linker Error Please Help! Why am I getting these the code looks correct??

Error 2 error LNK2019: unresolved external symbol "void __cdecl CheckWin(int %26amp;,int %26amp;,char * const,int %26amp;,int %26amp;,int %26amp;,int %26amp;,bool %26amp;,bool %26amp;,char * const)" (?CheckWin@@YAXAAH0QAD0000AA_N21@Z) referenced in function "void __cdecl SimpleAi(int %26amp;,int %26amp;,char * const,int %26amp;,int %26amp;,int %26amp;,int %26amp;,bool %26amp;,bool %26amp;,char * const)" (?SimpleAi@@YAXAAH0QAD0000AA_N21@Z) Ai.o...





Error 3 error LNK2001: unresolved external symbol "void __cdecl CheckWin(int %26amp;,int %26amp;,char * const,int %26amp;,int %26amp;,int %26amp;,int %26amp;,bool %26amp;,bool %26amp;,char * const)" (?CheckWin@@YAXAAH0QAD0000AA_N21@Z) TicT... .obj





Error 4 error LNK2019: unresolved external symbol "int __cdecl SinglePlayer(int %26amp;,int %26amp;,char * const,int %26amp;,int %26amp;,int %26amp;,int %26amp;,bool %26amp;,bool %26amp;)" (?SinglePlayer@@YAHAAH0QAD0000AA_N2@Z) referenced in function "int __cdecl Menu(int %26amp;,int %26amp;,char * const,int %26amp;,int %26amp;,int %26amp;,int %26amp;,bool %26amp;,bool %26amp;,char * const)" (?Menu@@YAHAAH0QAD0000AA_N21@Z) MainMenu...





Error 5 error LNK2019: unresolved external symbol "void __cdecl PlayersTurn(int %26amp;,int %26amp;,char * c

C++ Linker Error Please Help! Why am I getting these the code looks correct??
You Linker errror is saying, "I'm trying to pull together all the pieces of your program and I can't find something. In your case, it's the functions CheckWin, SinglePlayer, and PlayersTurn.





If you are getting these from a library, you may have included the header file, but you also need to add the actual library file name to the link list so the linker can find the code that executes the functions. The .h file only tells the compiler how to set up the calls.





If these are your subroutines, it's possible that your definition doesn't match the declaration as far as the type or order or the calling parameters.





Note: CheckWin@@YAXAAH0QAD0000AA_N... is what is known as a mangled name. Since you can have multiple functions with the same name and different calling parameters, the compiler creates a unique name by appending codes for each of the calling parameters.

morning glory

No comments:

Post a Comment