error LNK2019: unresolved external symbol _strncmp referenced in function "public: int __thiscall ...."  
Author Message
venkks





PostPosted: Visual C++ Language, error LNK2019: unresolved external symbol _strncmp referenced in function "public: int __thiscall ...." Top

Hi

I am new to C++.  There is a project earlier written in VC++ 6.0.  I opened the same project in VS. NET 2005 and I am trying to compile.  The code compiles properly (with couple of warnings) but while linking I am getting unresolved external symbol errors like this:

USBClient.obj : error LNK2001: unresolved external symbol __RTC_Shutdown

sha.lib(Sha.obj) : error LNK2001: unresolved external symbol __RTC_Shutdown

USBClient.obj : error LNK2001: unresolved external symbol __RTC_InitBase

sha.lib(Sha.obj) : error LNK2001: unresolved external symbol __RTC_InitBase

sha.lib(Sha.obj) : error LNK2001: unresolved external symbol _memset

comsuppwd.lib(invkprxy.obj) : error LNK2001: unresolved external symbol _memset

USBClient.obj : error LNK2019: unresolved external symbol _memcmp referenced in function _IsEqualGUID

USBClient.obj : error LNK2001: unresolved external symbol __purecall

LINK : error LNK2001: unresolved external symbol _mainCRTStartup

sha.lib(Sha.obj) : error LNK2019: unresolved external symbol _memcpy referenced in function _sha_hash

Please help me with this regard.

Thanks in advance!

 



Visual C++16  
 
 
crescens2k





PostPosted: Visual C++ Language, error LNK2019: unresolved external symbol _strncmp referenced in function "public: int __thiscall ...." Top

I suggest recreating the project in 2005 and adding the files again. The upgrade wizard goes weird at times and I think its better doing it this way to switch to the 2005 default settings.

But it looks like its not linking to the crt at all, so if you don't want to recreate, make sure the /nodefaultlib option isn't set, thats Ignore All Default Libraries in the IDE options.



 
 
Alexiel





PostPosted: Visual C++ Language, error LNK2019: unresolved external symbol _strncmp referenced in function "public: int __thiscall ...." Top

Hi,

http://msdn2.microsoft.com/en-us/library/6db3z985.aspx says :

When you open a .NET Class Library or ASP.NET Web Service project created in a previous version of Visual C++, /Zl will be added to the Command Line property page for the compiler in the project setting dialog box, but msvcrt.lib and msvcmrt.lib will not be added to the linker's Additional Dependencies property. This will result in a linker error (LNK2001) when you build the project. To resolve the error, add msvcrt.lib and msvcmrt.lib to the linker's Additional Dependencies property or delete /Zl from the compiler's Command Line property page.


 
 
joejavacavalier2001





PostPosted: Visual C++ Language, error LNK2019: unresolved external symbol _strncmp referenced in function "public: int __thiscall ...." Top

I had similiar problems building the BandObjs sample from the Platform SDK.

I'm using Visual Studio C++ 2005 Express.

(Someday I'll save enough money for a licensed copy of VS Professional. lol... :-)

The linker was not working well for me. It rejected code where I used "new" or any C-runtime function.

Here is my fix; this fix MAY work for you! (no guarantees...)

In the compiler options, where it says code generation, I specified "Multi-threaded" or /MT.

In the linker options, where it says input, I specified "libcmt.lib LIBCPMT.LIB" as my additional dependencies.

(I distributing extra DLL's with my software so I like everything to be statically linked. That means I need to be careful if I want to share CRT related data with other processes and DLL files. Then again, I'm selfish. I don't always like to share data. lol...)

For more information, I highly recommend reading this web page (and anything else Microsoft wrote on this subject).

http://msdn2.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx

Also please read the documentation about how to make the Platform SDK work with Visual Studio Express!

http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

Sincerely,

Joejava