cannot open file 'filename'
The tool could not open the given file.
Possible causes
- Not enough disk space.
- File does not exist. For example, you will get this error if you try to use the PGINSTRUMENT parameter to the /LTCG linker option on a machine with a 32-bit operating system.
- When specifying libraries in a project's property pages dialog box, library names should be separated by spaces (and not commas).
- Incorrect filename or path.
- Invalid drive specification.
- Insufficient file permissions.
- Path for filename expands to more than 260 characters.
- If the given file is named
LNKn, which is a filename generated by the linker for a temporary file, the directory specified in the TMP environment variable may not exist, or more than one directory is specified for the TMP environment variable. (Only one directory path should be specified for the TMP environment variable.) - If the error message occurs for a library name, and you recently ported the .mak file from a previous Microsoft Visual C++ development system, the library may no longer be valid. Ensure that the library still exists in this circumstance.
- Another program may have the file open and the linker cannot write to it.
- Incorrect LIB environment variable. For information on how to update the LIB environment variable, see VC++ Directories, Projects, Options Dialog Box. Make sure any directories with libraries you need are listed here.
The linker uses temporary files in several cases. Even if you have sufficient disk space, a very large link can deplete or fragment the address space. To address this issue:
- Use /opt:noref; doing transitive comdat elimination reads all the object files multiple times.
- Upgrade to Windows XP.