FIX: Custom Build Generates LNK1104 for Project Build from IDE

Last reviewed: September 19, 1997
Article ID: Q149496
The information in this article applies to:
  • The Developer Studio included with: - Microsoft Visual C++, 32-bit Edition, versions 4.0, 4.1, 4.2

SYMPTOMS

A custom build produces a LNK1104 error when you are building project from Developer 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 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>
    
       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" 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.

Keywords          : vcbuglist400 vcfixlist500 VwbIss
Version           : 4.0 4.1 4.2
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbfix


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 19, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.