简体   繁体   English

错误 LNK1181:编译为 .LIB 时无法打开输入文件

[英]Error LNK1181: cannot open input file when compiling as .LIB

I got a library here which uses the Intel Composer XE 2013 and I would like to compile it as a .lib as I am going to use it with another project (It is compiling as application/EXE by default).我在这里有一个使用 Intel Composer XE 2013 的库,我想将它编译为 .lib,因为我将在另一个项目中使用它(默认情况下它编译为应用程序/EXE)。 However, when I set the Configuration Type under Project Defaults under the Configuration Manager in Visual Studio 2012, I get " error LNK1181: cannot open input file" Odd part is that the file it looks for has no file ending.但是,当我在 Visual Studio 2012 中的配置管理器下设置项目默认值下的配置类型时,我收到“错误 LNK1181:无法打开输入文件”奇怪的部分是它查找的文件没有文件结尾。 The project contains both C, C++ and ASM code.该项目包含 C、C++ 和 ASM 代码。 Does anyone got any experience with this kind of behavior?有没有人对这种行为有任何经验?

Some common causes for error LNK1181 are:错误 LNK1181 的一些常见原因是:

  • 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.缺少指定包含文件名的目录的 /LIBPATH 语句。

To resolve the above issues, ensure any files referenced on the linker line are present on the system.要解决上述问题,请确保系统上存在链接器行上引用的所有文件。

Use the /LIBPATH option to override the environment library path.使用 /LIBPATH 选项覆盖环境库路径。 The linker will first search in the path specified by this option, and then search in the path specified in the LIB environment variable.链接器将首先在此选项指定的路径中搜索,然后在 LIB 环境变量中指定的路径中搜索。 You can specify only one directory for each /LIBPATH option you enter.您只能为您输入的每个 /LIBPATH 选项指定一个目录。 If you want to specify more than one directory, you must specify multiple /LIBPATH options.如果要指定多个目录,则必须指定多个 /LIBPATH 选项。 The linker will then search the specified directories in order.然后链接器将按顺序搜索指定的目录。

To set this linker option in the Visual Studio development environment在 Visual Studio 开发环境中设置此链接器选项

  1. Open the project's Property Pages dialog box.打开项目的属性页对话框。
  2. Click the Linker folder.单击链接器文件夹。
  3. Click the General property page.单击常规属性页。
  4. Modify the Additional Library Directories property.修改附加库目录属性。

If that doesn't help then you can look through these links :如果这没有帮助,那么您可以查看这些链接:

I solved the issue by renaming the .obj files without their file extension.我通过重命名没有文件扩展名的 .obj 文件解决了这个问题。 For example, it was looking for file name "foo", I had "foo.obj" so I renamed "foo.obj" to "foo".例如,它正在寻找文件名“foo”,我有“foo.obj”,所以我将“foo.obj”重命名为“foo”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C ++ CMake链接错误:LNK1181:无法打开输入文件“ x.lib” - C++ CMake Linking error: LNK1181: Cannot open input file “x.lib” (CMake构建)致命错误LNK1181:无法打开输入文件'glew.lib' - (CMake build) fatal error LNK1181: cannot open input file 'glew.lib' 链接:致命错误LNK1181:无法打开输入文件'cv.lib' - LINK : fatal error LNK1181: cannot open input file 'cv.lib' 链接:致命错误 LNK1181:无法打开输入文件“opencv_world341d.lib” - LINK : fatal error LNK1181: cannot open input file 'opencv_world341d.lib' 如何解决 LINK: fatal error LNK1181: cannot open input file 'vtkCommonCore-9.0.lib' - How to solve LINK : fatal error LNK1181: cannot open input file 'vtkCommonCore-9.0.lib' 错误LNK1181:无法打开输入文件'kernel32.lib' - error LNK1181: cannot open input file 'kernel32.lib' 链接:致命错误LNK1181:无法打开输入文件'libclamav.lib' - LINK : fatal error LNK1181: cannot open input file 'libclamav.lib' 错误 LNK1181 无法打开输入文件“mfcs110.lib” - Error LNK1181 cannot open input file 'mfcs110.lib' Qt 5.5.1 MSVC 2013,32位-LNK1181:无法打开输入文件'NIDAQmx.lib' - Qt 5.5.1 MSVC 2013, 32 bit - LNK1181: cannot open input file 'NIDAQmx.lib' LNK1181:无法打开输入文件“ oraocci10.lib” - LNK1181: cannot open input file 'oraocci10.lib'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM