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

前端 未结 19 3301
耶瑟儿~
耶瑟儿~ 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:47

    This indicates that Visual Studio wasn't able to find the lib (Library) directory which contains msvcrtd.lib.

    IMPORTANT: This lib directory also contains linkers required during the compilation process.

    So, all you need to do is override the Library Directory location. You can do so with the help of Environment Variables.

    I referred to this StackOverflow Post for help. As per the answer posted, the Environment Variable LIB refers to the path where the Linker Libraries are located. Why is this method better? Because this will apply to all the projects instead of just a particular project. Also, you don't need to download anything extra. It just works...

    Follow the steps below to achieve this:

    STEP-1: Search for "msvcrtd.lib" in the search bar.

    STEP-2: Click "Open File Location" (available in context menu)

    STEP-3: Copy the address of the directory from the address bar.

    STEP-4: Search "Environment" in the taskbar and click on "Edit the system environment variables".

    STEP-5: Click on "Environment Variables..." button.

    STEP-6: Under "System variables" section, click on "New..." button. A dialog would pop up.

    STEP-7: In the dialog box, enter the following:

    • Variable name: LIB
    • Variable value: [The directory you copied in "STEP-3"]

    And press "OK"

    Now, you are all done!

提交回复
热议问题