PRB: Project Dependency Doesn't Work as Expected: Fatal Error LNK1104: Cannot Open File (249263)



The information in this article applies to:

  • Microsoft Windows CE Platform Builder 2.12

This article was previously published under Q249263

SYMPTOMS

Within a new Windows CE platform you can have multiple projects, for which you have to declare dependencies. For example, if you have two projects, then you declare the first project, such as "Project1.dll", to be dependent upon the second project, which you might call "Project2.dll". If the dependencies are not specified properly, then a linker error occurs.

Problem:

When you build the platform, Project2 should be built first, and because of the dependency setting, Project1 should be built after this.

But if the dependency settings are not correct, then the build process may stop and the following error message appears:
Compiling resources...
Compiling...
Project1.cpp
Linking...
LINK : fatal error LNK1104: cannot open file
"..\Hardware\WCEX86Dbg\project2.lib"
Error executing link.exe.

CAUSE

This error depends on the order you added the projects relative to the dependency settings. You must first add the projects on which other projects are dependent.

RESOLUTION

You can find the dependency settings for each project and the platform in the Platform.pbw file. Make sure that the project that appears first in the Platform section is built first.

MORE INFORMATION

For example, the following lists Project2 before Project1. Project1 depends on project Project2 and therefore this is the correct way to list them.
Platform: "Platform"=.\platform.wce - Package Owner=4

Package=5
{{{
}}}

Package=4
{{{
    Begin Project Dependency
    Project_Dep_Name Project2
    End Project Dependency
    Begin Project Dependency
    Project_Dep_Name Project1
    End Project Dependency
}}}
				

Modification Type:MinorLast Reviewed:12/27/2003
Keywords:kbprb KB249263