FIX: Custom Build Generates LNK1104 for Project Build from IDE

This article was previously published under Q149496
This article has been archived. It is offered "as is" and will no longer be updated.
SYMPTOMS
A custom build produces a LNK1104 error when you are building project fromDeveloper Studio.
WORKAROUND
There are two workarounds:

  • Close the workspace after entering the Custom Build in Step 5 of the "Steps to Reproduce Problem" section of this article. Open the project again. The build will be successful this time. -or-

  • Go to an MS-DOS command prompt, and use NMAKE to build project.
STATUS
Microsoft has confirmed this to be bug in the Microsoft products listed atthe beginning of this article. This bug was corrected in Visual C++ version5.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.
  6. Type "The proof is in the build" 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
  7. Click in the first line of Output files. Type the following:
          $(ProjDir)\$(InputName).c
  8. Click OK.
  9. 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.
kbVC400bug
Properties

Article ID: 149496 - Last Review: 02/28/2014 08:02:11 - Revision: 1.1

  • Microsoft Visual Studio 6.0 Enterprise Edition
  • kbnosurvey kbarchive kbbug kbfix kbide kbvc500fix KB149496
Feedback