Error LNK2001: Unresolved External Character

I am converting my project from vc6 to VS 2010. When I compile my project, I get an error, as shown below, for entering .lib. I added all these libraries to Linker-> Input-> Additional Dependencies, also provided a path to these .lib files in the directories Link-> General-> Additional Library. Any advice on this would be very helpful.

lb0.lib(ob0.obj) :error LNK2001: unresolved external symbol "void __stdcall SetLastExP(class ExceptionClass *)" ( ?SetLastExP@ @ YGXPAVExceptionClass@ @@Z) lb1.lib(ob1.obj) : error LNK2001: unresolved external symbol "void __stdcall SetLastExP(class ExceptionClass *)" ( ?SetLastExP@ @ YGXPAVExceptionClass@ @@Z) lb2.lib(ob2.obj) : error LNK2001: unresolved external symbol "void __stdcall SetLastExP(class ExceptionClass *)" ( ?SetLastExP@ @ YGXPAVExceptionClass@ @@Z) lb3.lib(ob3.obj) : error LNK2001: unresolved external symbol "void __stdcall SetLastExP(class ExceptionClass *)" ( ?SetLastExP@ @ YGXPAVExceptionClass@ @@Z) lb3.lib(ob4.obj) : error LNK2001: unresolved external symbol "void __stdcall SetLastExP(class ExceptionClass *)" ( ?SetLastExP@ @ YGXPAVExceptionClass@ @@Z) lb3.lib(ob5.obj) : error LNK2001: unresolved external symbol "void __stdcall SetLastExP(class ExceptionClass *)" ( ?SetLastExP@ @ YGXPAVExceptionClass@ @@Z) lb4.lib(0b6.obj) : error LNK2001: unresolved external symbol "void __stdcall SetLastExP(class ExceptionClass *)" ( ?SetLastExP@ @ YGXPAVExceptionClass@ @@Z) 

thanks

+4
source share
2 answers

You need to determine where the SetLastExP() function is SetLastExP() .

  • Verify that the library implementing SetLastExP is linked.
  • Get the .obj file and check with dumpbin if it implements in the expected decoration.

     dumpbin /symbols foo.obj | find "External" | find "SetLastExP" 
  • Compare the decoration that you see with the image that you have in the Linker error message.

The function is probably defined as extern "C" , while your header file does not reflect this.

+7
source

Sometimes, if you have different character sets ( Configuration propertiesgeneral ) in your subprojects, Visual Studio shows this error:

 error LNK2001: unresolved external symbol" with an *.obj 
+3
source

Source: https://habr.com/ru/post/1339990/


All Articles