LINK : fatal error LNK1104: cannot open file 'MSVCRTD.lib'

前端 未结 19 3244
耶瑟儿~
耶瑟儿~ 2020-12-09 03:04

I\'m a novice C++ developer. I encontered the error message indicates \"LINK :fatal error LNK1104: cannot open file \'MSVCRTD.lib\'\" while I\'m trying to debug every single

相关标签:
19条回答
  • 2020-12-09 03:31

    The above answer was not quite accurate for me. I have VS2010 Ultimate installed and the file in question is not in my Visual Studio 10.0\VC folder. Rather I found it in the Visual Studio 9.0\VC folder. So if that's the case for anyone, follow the lead to change the Linker but use the Visual Studio 9.0\VC folder instead. It worked for me.

    0 讨论(0)
  • 2020-12-09 03:32

    There is a check box that says "Inherit from parent or project defaults" in some of the property dialogs in Project Properties. Make sure that check box is checked for your Include and Library directories property windows and of course for your Additional Dependencies window.

    0 讨论(0)
  • 2020-12-09 03:34

    I came across this problem when compiling a sample app using VS2017 Hope this will help

    0 讨论(0)
  • 2020-12-09 03:38

    I got a slightly different error

    LNK1104 cannot open file 'MSVCURTD.lib'

    Note it is msvcUrtd (not msvcrtd), but the file is not found on my system.

    Solved it by setting the following options:

    Project Properties
     General
      Character Set: Not Set
      Common Language Runtime Support: Common Language Runtime Support (/clr)
    

    Hope that helps.

    0 讨论(0)
  • 2020-12-09 03:39

    For the poor souls out there who are struggling with this, after an hour of research I found a solution for my Visual Studio Enterprise 2017:

    First, lets find where is your library file located:

    With windows explorer, go to your directory where Visual Studio is installed, (default: C:\Program Files (x86)\Microsoft Visual Studio) and do a search for msvcrtd.lib

    I found mine to be in here:

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\lib\onecore\x86
    

    Quick Fix (for one project only):

    1. Right click on your project, click on properties, navigate to Linker, add that path to Additional Library Directories

    Permanent Fix (for all projects)

    1. Open a project
    2. navigate to View > Property Manager (it could be under Other Windows)
    3. Expand all folders and multi select all "Microsoft.cpp.Win32.user" & "Microsoft.cpp.64.user"

    1. Right click and go to properties
    2. Navigate to VC++ Directories

    3. Add the path to default Library Directories

    0 讨论(0)
  • 2020-12-09 03:39

    For VS 2019, Spectre Mitigation is enabled by default. So the right way to fix the issue would be to install VC++ Libs for Spectre.

    But, to quickly resolve the issue, you may disable Spectre Mitigation

    Project Properties -> C/C++ -> Code Generation -> Spectre Mitigation -> Disabled

    https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/

    0 讨论(0)
提交回复
热议问题