Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
PRB: Missing /c Compiler Option Causes LNK1561 Linker Error
This article was previously published under Q228455
When compiling a multiple source file project that creates a pre-compiled header file inside the Visual C++ Integrated Development Environment (IDE), the following error can occur:
Compiling...
StdAfx.cpp
LINK : fatal error LNK1561: entry point must be defined
Error executing cl.exe.
NOTE: The linker error is generated during the compiler phase of the build.
The /c compiler option is missing from the build settings.
Add /c to the compiler options. To do this, you must edit the compiler options in the
Project Options box in the
C/C++ tab under
Project Settings.
NOTE: This box is only editable if the whole project is selected in the tree control on the
Project Settings.
This behavior is by design.
By default, the Visual C/C++ compiler attempts to compile and link in a single step. The /c (Compile without Linking) option is used to tell the compiler to compile only. Since Visual C++ compiles and links in separate steps, then /c is required for all Visual C++ builds.
To reproduce the error, create a default MFC project and remove the /c option from the Project Settings by editing the compiler options in the
Project Options box in the
C/C++ tab under
Project Settings.
Article ID: 228455 - Last Review: November 18, 2003 - Revision: 2.0
APPLIES TO
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++, 32-bit Learning Edition 6.0
| kbprb kbcompiler KB228455 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate