Severity Code Description Project File Line Suppression State Error LNK1181 cannot open input file 'Psapi.lib LINK 1

Tawanda Nyahuye 21 Reputation points
2020-09-22T19:25:40.87+00:00

I am trying to build a C++ application in Visual Studio 2019 Professional but I am getting the following error:

Severity Code Description Project File Line Suppression State Error LNK1181 cannot open input file 'Psapi.lib LINK 1

I have Psapi.lib in Linker -> Input -> Additional dependencies

Linker -> General -> Link Library dependencies is set to yes I tried switching it to No and I got the same error

Linker -> General -> UseLibrary dependencies is set to yes

I checked in C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\arm and Psapi.lib is there

26659-image.png

Developer technologies | C++
0 comments No comments
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2020-09-23T01:40:41.003+00:00

    Hi,

    You got an LNK1181 error in Visual Studio when the .lib files that are specified during linking are not found in the current directory, any of the directories that are specified by the LIBPATH linker option, or any of the directories that are specified in the LIB environment variable.

    I suggest you may add the directory that contains Psapi.lib library file to the LIBPATH to resolve the error:

    1,In Solution Explorer, right-click the project, and then click Properties.
    2,In the Property Pages dialog box, expand Linker, and then click General.
    3,In the Additional Library Directories field, specify the path where Psapi.lib resides.

    The error can also happen when the LIBPATH contains spaces. If that's the case, move the library to a path without spaces or put quotation marks around the path.

    For more details I suggest you could refer to the Doc: Linker Tools Error LNK1181.

    Best Regards,

    Jeanine Zhang


    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.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. David Lowndes 4,726 Reputation points
    2020-09-22T20:17:23.277+00:00

    Do you have psapi.lib available in any of the library directory paths that your project settings are using (see your project's property pages, Configuration Properties, VC++ Directories)?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.