Error message when you try to use Visual Studio 2005 to build a Microsoft Visual C++ native class library project: "LNK1104"

Article translations Article translations
Article ID: 937466 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

When you try to use Microsoft Visual Studio 2005 to build a Microsoft Visual C++ native class library project, you may receive an error message that resembles the following:
LNK1104: cannot open file ‘FileName
Note In this error message, FileName represents the name of a DLL that could not be linked correctly.

This problem occurs when you use the #import directive in the project to reference a mixed-mode DLL.

CAUSE

This problem occurs because the Visual C++ build system cannot link to a library when a dependent DLL of that library is a managed DLL that has no native exports. The mixed-mode DLL contains both managed exports and native exports. However, the build system does not detect the native exports.

WORKAROUND

To work around this problem, follow these steps:
  1. In Visual Studio 2005, click the name of the project in Solution Explorer, and then click Properties on the Project menu.
  2. In the Property Pages dialog box, expand Configuration Properties, expand Linker, and then click General.
  3. Select No under Link Library Dependancies, and then click OK.

    Note When you set Link Library Dependancies to No, libraries that you reference by using the #import directive are not linked during the build process.
  4. Manually add a reference for each library that is required for the project. To do this, follow these steps for each library:
    1. On the Project menu, click References.
    2. In the Property Pages dialog box, click Add New Reference.
    3. Click the name of the library that you want to add, and then click OK.
  5. On the Build menu, click Build Solution.

STATUS

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

Properties

Article ID: 937466 - Last Review: July 6, 2007 - Revision: 1.0
APPLIES TO
  • Microsoft Visual Studio 2005 Express Edition
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Team Edition for Database Professionals
  • Microsoft Visual Studio 2005 Team Edition for Software Architects
  • Microsoft Visual Studio 2005 Team Edition for Software Developers
  • Microsoft Visual Studio 2005 Team Edition for Software Testers
  • Microsoft Visual Studio 2005 Team Suite
  • Microsoft Visual Studio 2005 Team Foundation
  • Microsoft Visual Studio 2005 Team System Test Edition
Keywords: 
kbtshoot kbexpertiseinter kbexpertisebeginner kberrmsg kbbug kbprb KB937466

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com