链接:致命错误LNK1104:手动配置LIB环境变量后无法打开文件'libcpmt.lib' [英] LINK : fatal error LNK1104: cannot open file 'libcpmt.lib' after manually configuring the LIB environmental variable

查看:162
本文介绍了链接:致命错误LNK1104:手动配置LIB环境变量后无法打开文件'libcpmt.lib'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从命令行使用 cl Visual Studio 2010编译器。

I'm trying to use the cl Visual Studio 2010 compiler from the command line.

对于某些原因,我安装的Visual Studio 2010无法正确配置 INCLUDE LIB 目录,请参见关于致命错误C1034的另一篇文章:没有包含路径集。如果我运行

For some reasons, my installation of Visual Studio 2010 is not able to correctly configure the INCLUDE and LIB directories, see Yet another post on fatal error C1034: no include path set. If I run

`vcvars32.bat`

我收到以下错误消息:

ERROR: Cannot determine the location of the VS Common Tools folder.

然后我尝试手动设置这些环境变量。所以我创建了一个简单的 bat 文件,如下所示:

I then tried to set these environmental variables manually. So I created a simple bat file as follows:

Set INCLUDE="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include;"

Set LIB="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;"

cl test.cpp

但是我现在收到以下错误

but I now receive the following error

LINK : fatal error LNK1104: cannot open file 'libcpmt.lib'

我不明白为什么会发生这种情况,因为 libcpmt.lib 位于上述<$ c $之一内c> LIB 目录。

I do not understand why this happens, since libcpmt.lib is inside one of the above LIB directories.

对这个问题有解决方案吗?

编辑

我在 VS2010命令提示符给出错误:无法确定VS Common Tools文件夹的位置,现在已设置 VS100COMNTOOLS 环境变量。但是即使我尝试手动设置它们,但仍未设置 INCLUDE LIB 环境变量>

I used the procedure in the first answer to VS2010 command prompt gives error : Cannot determine the location of the VS Common Tools folder and now the VS100COMNTOOLS environment variable is set. But the INCLUDE and LIB environment variables are still not set, even if I try to set them manually by

set INCLUDE = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include;"

set LIB = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;"

因此,当我尝试编译 .cpp 我收到的文件

Accordingly, when I try to compile the .cpp file I receive

fatal error C1034: iostream: no include path set

编辑:最终解决方案

根据Hans Passant的建议,是最终的解决方案

Following Hans Passant's suggestions, this is the final solution

@SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include;

@SET LIB=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;

cl /EHsc -o FileName.obj -c FileName.cpp


推荐答案

摆脱双引号。

真正的问题是未设置VS100COMNTOOLS环境变量。您需要找出造成环境混乱的原因。控制面板+系统+高级+环境变量。或使用VS安装程序修复选项。更改后注销并登录。

The real problem is that the VS100COMNTOOLS environment variable isn't set. You'll need to find out why the environment got messed up like that. Control Panel + System + Advanced + Environment variables. Or use the VS setup repair option. Logout + Login after making changes.

这篇关于链接:致命错误LNK1104:手动配置LIB环境变量后无法打开文件'libcpmt.lib'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆