Microsoft KB Archive/149496

= FIX: Custom Build Generates LNK1104 for Project Build from IDE =

Article ID: 149496

Article Last Modified on 8/11/2005

-

APPLIES TO


 * Microsoft Visual Studio 6.0 Enterprise Edition

-



This article was previously published under Q149496



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.



Steps to Reproduce Problem
  Create two directories:   \Junk \Junk\Src   Create a text file named \Junk\Src\Source.cs that has the following contents: #include 0

void main( void ) {    printf("Custom build options has a bug\n"); }   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.  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.</li> 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.</li>  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 </li>  Click in the first line of Output files. Type the following: $(ProjDir)\$(InputName).c </li> Click OK.</li> 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.</li></ol>

Additional query words: kbVC400bug

Keywords: kbbug kbfix kbide kbvc500fix KB149496

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.