BUG: "LNK2005" linker error message when you build the TextInterpreter sample project (832729)



The information in this article applies to:

  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C++ .NET (2003)
  • Microsoft Visual C++ .NET (2002)
  • Microsoft Visual Studio Industry Partner Software Development Kit

Note Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET 2003 support both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model. The information in this article applies only to unmanaged Visual C++ code. Microsoft Visual C++ 2005 supports both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model.

SYMPTOMS

When you build the TextInterpreter sample project that is included with the Microsoft Visual Studio Industry Partner Software Development Kit (VSIP SDK), you may receive the following linker error message:
LNK2005: "long __stdcall ATL::AtlWinModuleInit(struct ATL::_ATL_WIN_MODULE70 *)" (?AtlWinModuleInit@ATL@@YGJPAU_ATL_WIN_MODULE70@1@@Z) already defined in ad2de.lib(dbgmetric.obj)

CAUSE

The Use of ATL configuration property is incorrectly set to Not Using ATL in the TextInterpreter sample project although it is a Microsoft Active Template Library (ATL) project.

RESOLUTION

Change the Use of ATL configuration property from Not Using ATL to Dynamic Link to ATL. To do this, follow these steps:
  1. Install the Microsoft Visual Studio Industry Partner Software Development Kit (VSIP SDK).
  2. Start Microsoft Visual Studio .NET 2002, Microsoft Visual Studio .NET 2003, or Microsoft Visual Studio 2005.
  3. On the File menu, point to Open, and then click Project.
  4. In the Open Project dialog box, locate the TextInterpreter sample project that is installed on your computer where you installed the VSIP SDK samples.

    You can find the TextInterpreter sample in the Installed Path\Microsoft Visual Studio Debugging SDK\Debugging SDK Samples\Text Interpreter Sample directory. Installed Path is a placeholder for the drive where the VSIP SDK is installed.
  5. Click to select the TextInterpreter project or workspace file, and then click Open.
  6. In the Visual C++ Project dialog box, click Yes to convert the project to the format that Visual Studio .NET or Visual Studio 2005 uses.
  7. In Solution Explorer, right-click the TextInterpreter project node, and then click Properties.
  8. In the TextInterpreter Property Pages dialog box, expand Configuration Properties, and then expand C/C++.
  9. Click General, and then type the path for the include files of the TextInterpreter sample project in the Additional Include Directories box.

    You can find these files in the Installed Path\Microsoft Visual Studio Debugging SDK\Includes directory. Installed Path is a placeholder for the drive where the VSIP SDK is installed.
  10. Collapse the C/C++ folder, and then expand the Linker folder.
  11. Click General, and then type the directory path for the library files of the TextInterpreter sample project in the Additional Library directories box.

    You can find these files in the Installed Path\Microsoft Visual Studio Debugging SDK\Libs directory. Installed Path is a placeholder for the drive where the VSIP SDK is installed.
  12. Collapse the Linker folder, and then click General in the Configuration Properties folder.
  13. Change the Use of ATL property on the right side from Not Using ATL to Dynamic Link to ATL.
  14. Click Apply, and then click OK to close the TextInterpreter Property Pages dialog box.
  15. Press CTRL+SHIFT+B to build the TextInterpreter sample project. The sample project builds successfully.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section of this article.

Modification Type:MajorLast Reviewed:1/17/2006
Keywords:kberrmsg kbDirectory kbATLServer kbProperties kbMigration kbmigrate kbconversion kbbug KB832729 kbAudDeveloper