In Visual Studio, if you are facing “fatal error LNK1221” while building your project, then this post is for you. Here is the exact error that appears in the output console that you will know how to fix.
fatal error LNK1221: a subsystem can't be inferred and must be defined
The reason behind the error is; the SubSytem value is not set in your project settings or is having a wrong entry. Like other issues in Visual Studio, this is pretty simple, and follow the below steps to fix it.
The “fatal error LNK1221” appears when the subsystem under the Linker section is not defined in Visual Studio. To fix the error, under the Linker section of project properties, go to System → Subsystem and select Windows (/SUBSYSTEM:WINDOWS).
Steps to fix LNK1221 error:
- Open the Visual Studio project.
- Right-click on the project and go to Properties.
- Under the Linker section, select System.
- In the right panel, under the SubSystem section, choose Windows (/SUBSYSTEM:WINDOWS) from the list of values.
- Click OK to save the project settings.
Now, if you build the project, the error will no longer appear.
That’s all. I hope the issue “fatal error LNK1221: a subsystem can’t be inferred and must be defined” is resolved after following the above steps. Do share your feedback in the comments section or in case you face any issues, we would be happy to help.
Other Visual Studio errors: