BUG: ATL Service EXE Doesn't Build in Release Build

Last reviewed: June 16, 1997
Article ID: Q167946
The information in this article applies to:
  • Microsoft Visual C++, 32-bit Editions, version 5.0

SYMPTOMS

If you try to build a release mode of an ATL service EXE created with ATL COM AppWizard, you get the following the error message:

   "error LNK2001: unresolved external symbol _main"

CAUSE

Builds in release mode automatically include the preprocessor directive _ATL_MIN_CRT, while the default ATL service code generated by the wizard requires the CRT library.

RESOLUTION

Remove _ATL_MIN_CRT from the list of preprocessor defines to allow CRT startup code to be included.

  1. On the Project menu, click Settings.

  2. In the Settings For: drop-down list, choose Multiple Configurations.

  3. In the "Select project configuration(s) to modify" dialog box that appears, select the check boxes for all Release versions, and then click OK.

  4. Click the C/C++ tab in the Project Settings dialog box, and then choose the General category.

  5. Remove _ATL_MIN_CRT from the Preprocessor definitions edit box.

Alternatively, you can remove calls to the CRT functions within the generated CServiceModule::LogEvent function.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Server Exe project using ATL COM Appwizard.

  2. Build one of the release builds.

The error should occur.

REFERENCES

For additional information about using CRT in ATL projects, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q165076
   TITLE     : INFO: LNK2001 Error ATL Release Build


Additional query words: Server
Keywords : kberrmsg kbtool vcbuglist500 WizardIss kbfasttip
Technology : kbatl
Version : 5.0
Platform : NT WINDOWS
Issue type : kbbug


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.