Unrecognized switch using MS C 5.1

Jeff Henkels jeff at kfw.COM
Wed Sep 19 02:00:09 AEST 1990


In article <1990Sep17.200600.9089 at sea.com> kbickel at sea.com (Ken Bickel) writes:
>Does anyone know why the following error message is occuring when I
>attempt to compile and link a simple C program using Microsoft's
>CL.EXE (version 5.1):
>
>   unrecognized switch error:  "NOI"
>
>The error message occurs as the linking process is starting up.

What is happening is that CL is using the wrong link program.  Microsoft
has the habit of calling all their linkers LINK.EXE, including the linker
that comes as part of MS-DOS.  If the DOS subdirectory precedes the MSC
\BIN subdirectory in your path, CL (and all other Microsoft compilers) will
invoke the old DOS linker, which doesn't support /NOI (or several other 
options).  

Fortunately the fix is really easy; rename the DOS linker to anything
other than LINK.EXE.  Also, make sure that there aren't any old versions
of LINK.EXE floating around in your path; if MS Basic, FORTRAN, or
PASCAL are installed, their older LINK.EXE's might cause problems as well.
Any MS compiler can use the newer versions of LINK, but MSC can't use some
of the older versions, as you have discovered.

>I've tried installing the compiler on serveral different 286's using
>the same installation steps, and the error will only occur on one of
>the machines.  

Interesting.  I've also installed MSC on a number of machines, and this 
problem would occur on every single one.  Of course, all the machines had
the DOS LINK.EXE present and at the top of the path.

Anyway, if you make sure that MSC invokes its own linker, everything will
be ok.

Hope this helps.
Jeff



More information about the Comp.lang.c mailing list