PRB: "Invalid Object Module" Error Usually From Old LINK

Last reviewed: July 17, 1997
Article ID: Q22331
5.10 6.00 6.00a 6.00ax 7.00 | 1.00 1.50
MS-DOS                      | WINDOWS
kbtool kbfasttip kbprb

The information in this article applies to:

  • Microsoft C for MS-DOS, versions 5.1, 6.0, 6.0a, and 6.0ax
  • Microsoft C/C++ for MS-DOS, version 7.0
  • Microsoft Visual C++ for Windows, versions 1.0 and 1.5

SYMPTOMS

An attempt to link an application fails and the Microsoft LINK utility generates the following message:

      invalid object module

CAUSE

An incorrect version of Microsoft LINK is in use. In many systems, the MS-DOS directory is listed near the beginning of the PATH environment variable. MS-DOS includes a version of LINK that is often used instead of the version provided with the C compiler.

RESOLUTION

Perform one of the following two steps to address this problem:

  • Rename the older version of the linker. For example, change its name to LINK.OLD. The MS-DOS linker is probably not needed, but this method assures that it remains available.

    -or-

  • Modify the contents of your PATH environment variable to list the directory that contains the correct version of LINK.EXE before any other versions. However, the problem is more likely to recur with this approach when you make subsequent modifications to your system.

MORE INFORMATION

To verify that an incorrect linker version is the cause of an "invalid object module" error, perform the following six steps:

  1. Change the current directory to the directory in which the LINK.EXE version provided with the C compiler is installed.

  2. Type "link" (without the quotation marks) at the MS-DOS command prompt.

  3. When LINK displays its copyright banner message, note the displayed version number. This is the correct version of LINK to use.

  4. Press CTRL+C to exit LINK.

  5. Change the correct directory to the directory in which you compile and link your application.

  6. Repeat steps 2 through 4 in this directory.

If the LINK version number that displays in your working directory is less than the version number that displays in the C compiler directory, then an older version of the LINK utility is installed in a directory listed in the PATH environment variable before the directory that contains the correct LINK version.

If you have an older version of LINK.EXE installed on your system, determine the directory in which it is installed. Most likely, it is in your MS-DOS directory. However, it could be the linker from another Microsoft language product.

Because it is not uncommon to have a number of linkers in various directories specified in the PATH, repeat the test above after you make any of the modifications recommended in the RESOLUTION section of this article.


Additional reference words: 1.00 1.50 5.10 6.00 6.00a 6.00ax 7.00
KBCategory: kbtool kbfasttip kbprb
KBSubcategory: LinkIss
Keywords : kb16bitonly


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: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.