Linker Tools Error LNK1168 in VS 2022

Matthew Armshaw 81 Reputation points
2025-04-02T23:07:30.4433333+00:00

I am developing a C++ Windows Desktop App in Microsoft Visual Studio 2022. Everything was working fine (for 2 days). Then I received the LNK1168 error. I researched on the net, and most people suggested to check for locked files or an already open executing app instance. I have tried searching for an open process which I could not find in Task Manager, Resource Monitor, or Process Explorer. I have tried renaming the project and rebuilding. I have restarted VS and have tried rebooting the computer and reopening the project and rebuilding .I have copied all code to a new VS2022 project. No matter what I do after a few builds, this error is returned (for all subsequent builds). I have opened other VS projects and the same error is returned when I try to build. Do you think I should reinstall Windows 11 or Visual Studio? Is there another easier fix?

Thanks for any help.

Matt

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
1,071 questions
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 34,311 Reputation points Microsoft External Staff
    2025-04-03T08:29:13.4133333+00:00

    Hi @Matthew Armshaw ,

    Does the error message show any file name?

    Even rebooting the machine didn’t work, I doubt that the locked file is related to system environment.

    This document: Linker Tools Error LNK1168 says:

    This error is often caused by a transient condition – for example, a lock held by an anti-virus program, a file search indexing process, or a delay in releasing a lock held by the Visual Studio build system.

    Have you also tried to check the anti-virus program, maybe try to disable it temporarily and reboot your machine?

    Please also try to run VS as administrator.

    Another suggestion is to update Windows OS, make sure all the patches have been installed, and no Windows Update program is running in the background.

    I doubt this is a temporary issue and maybe the next time you launch your machine, the issue disappears.

    Best regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.


0 additional answers

Sort by: Most helpful

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.