Visual Studio 2017 C++ Linking Error: LNK2019: unresolved external symbol __imp___stricmp referenced in function

Maiti, Souvik 26 Reputation points
2021-10-04T16:55:29.38+00:00

Hello All - I'm working on upgrading a C++ project from Visual Studio 2008 to Visual Studio 2019. The conversion went well without any error. While trying to build the project under Release | Win32, getting one single error.

FileStream.obj : error LNK2019: unresolved external symbol __imp___stricmp referenced in function "private: struct _GUID __thiscall CFileStream::GetMediaSubType_Ext(char *,int)" (?GetMediaSubType_Ext@CFileStream@@0xAAE ?AU_GUID@@PADH@Z)

I have included all the required libraries under Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies. I have added the msvcrt.lib in it.

A little more details about the project -
Target Platform - Windows 10
Windows SDK Version - 10.0.17763.0
Configuration Type - Dynamic Library (.dll)
Code Generation - Multi-threaded (/MT)
Ignore All Default Libraries - Yes (/NODEFAULTLIB)

Thanks in advance for help. Please let me know in case of any additional queries.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,519 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 40,021 Reputation points
    2021-10-05T14:07:56.21+00:00

    I reproduced the issue by trying to build a small C application with two source files. The project properties were set to use the static CRT (/MT), but one of the source files had its properties set to use the DLL version of the CRT (/MD).

    Consequently, it appears to me that the FileStream module has been compiled using /MD instead of /MT


3 additional answers

Sort by: Most helpful
  1. David Lowndes 4,711 Reputation points
    2021-10-04T17:36:22.67+00:00

    Does your code use stricmp or _stricmp? It should probably use the latter name. See here.


  2. RLWA32 40,021 Reputation points
    2021-10-04T18:20:36.707+00:00

    Well, since the unresolved symbol is __imp__stricmp it seems that the linker wants to use an import library for the DLL version of the UCRT. However, the Code Generation option is /MT which leads me to believe that you have not passed any import libraries to the linker. You probably need to provide Ucrt.lib as a linker input.


  3. Jeanine Zhang-MSFT 9,101 Reputation points Microsoft Vendor
    2021-10-05T02:58:13.547+00:00

    Hi,

    I suggest you should check if the platform and configuration settings are consistent with the build time (Release | Win32).

    137604-image.png

    Best Regards,

    Jeanine


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.