FIX: Custom Build Generates LNK1104 for Project Build from IDE

ID: Q149496


The information in this article applies to:


SYMPTOMS

A custom build produces a LNK1104 error when you are building project from Developer Studio.


WORKAROUND

There are two workarounds:


STATUS

Microsoft has confirmed this to be bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ version 5.0.


MORE INFORMATION

Steps to Reproduce Problem

  1. Create two directories:
    
       \Junk
       \Junk\Src 


  2. Create a text file named \Junk\Src\Source.cs that has the following contents:
    
       #include <stdio.h>0
    
       void main( void )
       {
         printf("Custom build options has a bug\n");
       } 


  3. In Developer Studio, on the File menu, choose New, and then choose Project Workspace. Select the Console Application type in the New Project Workspace dialog box. Type a name (for example, test1), and then the project location should read:
    
       \Junk\Src\Test
    
       Create the project. 


  4. On the Insert menu, choose Files into project, and type ..\Source.cs for the file name. Then click OK. On the Insert menu, choose Files into project again. Type Source.c for the file name, and click OK. Developer Studio will say this file doesn't exist and ask if you want to add it as a reference; click Yes.


  5. On the Build menu, choose Settings. Expand both the Debug and Release branches of Project Settings by clicking the plus sign (+) next to each project target. Select Source.cs under Debug and Control. Then click Source.cs under Release. Choose the Custom Build tab.

    Type "The proof is in the build" (without the quotation marks) for the Description. Click in the first line of Build commands. Type the following (use macro menus if you wish):
    
          copy ..\$(InputName).cs $(ProjDir)\$(InputName).c 
    Click in the first line of Output files. Type the following:
    
          $(ProjDir)\$(InputName).c 
    Click OK.


  6. Build the project. It will do the custom build step but it will not follow it up with a compile of the .c file and a linker error LNK1104 (cannot open ".\Debug\Source.obj") will be generated. Note that choosing to Save all after setting the custom build option in Step 5 has the same effect.


Additional query words: kbVC400bug


Keywords          : kbide kbVC kbVC500fix kbGrpDSTools 
Version           : 4.0 4.1 4.2
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: July 28, 1999