If you a developer using Visual Studio for writing code, then you may encounter the below error at some point of time.
LINK : fatal error LNK1561: entry point must be defined
The error is self-explanatory but you must know how to fix it. If you are facing this fatal error LNK1561 error, you are at the right place. I will share the steps you can follow to resolve this Visual Studio error. Typically the error can appear on any version of Visual Studio and the below steps are applicable on all versions of Visual Studio IDE.
The error LINK : fatal error LNK1561: entry point must be defined” appears when you are trying to build the code. The VS linker does not find the entry point function in your code; so it can not call your code.
Fix fatal error LNK1561: entry point must be defined
There can be multiple scenarios when you can get this error. In this article, I will share 3 common checks that you can verify in your project configuration to make sure the error does not appear.
In the first troubleshooting step, you need to know the intent of your code. If you have written the code to build a .dll or .lib; and your project settings is configured as .exe, then you will get this error.
You need to change the “Configuration type” from exe to dll or lib.
- Right-click on the project (not on the solution) and go to properties.
- Under General section, look for the “Configuration type” field.
- Change the type from Application (.exe) to Dynamic Library (.dll) or Static Library (.lib) based on your code.
- Click on OK to save the changes.
- Clean the project and build it again.
If the intent of your code is to build an exe, then the Fix #1 does not hold good. If you are creating a console application, the linker looks for main function and for Windows application, it expects WinMain function to be present as entry point to your code.
- Go to project properties by right clicking on the project and selecting properties from the list.
- Under Linker → Advanced section, check the “Entry Point” field.
- If the field is empty and you have main/WinMain present as the entry point, the issue should not appear.
- In case, you face the same error, you can manually update the Entry Point to main/WinMain based on your project type.
If you have a different entry point function other than main or WinMain, you need to update the function name in the “Entry Point” field.
- Right-click on the project and go to properties.
- Under Linker → Advanced section, update the “Entry Point” field to your function name.
That’s it. These are the only possible steps to fix “fatal error LNK1561: entry point must be defined” error in Visual Studio. I hope your issue is not resolved. Do share your comments below and any tips and tricks you followed to help other developers.
Other Visual Studio errors: