Linker Tools Error LNK1181

cannot open input file 'filename'

The linker could not find filename because it does not exist or the path was not found.

Some common causes for error LNK1181 include:

  • filename is referenced as an additional dependency on the linker line, but the file does not exist.

  • A /LIBPATH statement that specifies the directory containing filename is missing.

To resolve the above issues, ensure any files referenced on the linker line are present on the system. Also ensure there is a /LIBPATH statement for each directory containing a linker-dependent file.

For more information, see .lib Files as Linker Input.

Another possible cause for LNK1181 is that a long file name with embedded spaces was not enclosed in quotation marks. In that case, the linker will only recognize a file name up to the first space, and then assume a file extension of .obj. The solution to this situation is to enclose the long file name (path plus file name) in quotation marks.

Compiling with the /P (Preprocess to a File) option can result in LNK1181 because that option suppresses the creation of .obj files.

See also

/LIBPATH (Additional Libpath)