visual-studio MS C++ 2010 和 mspdb100.dll
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2990331/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MS C++ 2010 and mspdb100.dll
提问by zildjohn01
Microsoft's C++ compiler and linker seem to have an odd relationship with mspdb100.dll. When run from the IDE, of course, the compiler and linker work fine. When running either one from the command line, I get an error.
Microsoft 的 C++ 编译器和链接器似乎与mspdb100.dll. 当从 IDE 运行时,编译器和链接器当然可以正常工作。从命令行运行任何一个时,我都会收到错误消息。
No problem, I located the DLL and copied it to the directory. Now the compiler works fine, but the linker dies.
没问题,我找到了 DLL 并将其复制到目录中。现在编译器工作正常,但链接器死了。
I could solve the problem by adding "%VS10%\Common7\IDE" to my PATH, but for various reasons (performance, system purity, OCD, etc), I don't want to do that. Why is this setup so touchy, and is there anything else I can do to solve it?
我可以通过将“%VS10%\Common7\IDE”添加到我的 PATH 来解决这个问题,但是由于各种原因(性能、系统纯度、OCD 等),我不想这样做。为什么这个设置如此敏感,我还能做些什么来解决它?
回答by Michael Paulukonis
try running path\to\VC\bin\vcvars32.batfrom within your current shell first. This should ensure your command-line setup will match the IDE-setup.
尝试运行path\to\VC\bin\vcvars32.bat从当前的外壳内第一。这应该确保您的命令行设置与 IDE 设置匹配。
This is not a permanent fix -- you need to do it every time you launch a new shell.
这不是永久性修复——每次启动新 shell 时都需要这样做。
You could probably also find some way to add everything that's in that .batpermanently to the environment variables, but.... like you asked, why the heck doesn't the MS install do that already?
您可能还可以找到某种方法将其中的所有内容.bat永久添加到环境变量中,但是.... 就像您问的那样,为什么 MS 安装还没有这样做呢?
回答by monokrome
Add Microsoft Visual Studio 10.0\Common7\IDE to your path, and this issue will not exist any more. You will be able to build without running this silly batch file every time.
将 Microsoft Visual Studio 10.0\Common7\IDE 添加到您的路径中,此问题将不再存在。您将能够构建而无需每次都运行这个愚蠢的批处理文件。
回答by LokMac
I noticed when I installed Microsoft Visual Studio 2010 Express that under the "Microsoft Visual Studio 2010 Express" folder in the Start Menu, there is a link to "Visual Studio Command Prompt (2010)", which sets up all the necessary environment variables when opened. That way you shouldn't have to edit you PATH variable.
我在安装 Microsoft Visual Studio 2010 Express 时注意到,在“开始”菜单的“Microsoft Visual Studio 2010 Express”文件夹下,有一个指向“Visual Studio Command Prompt (2010)”的链接,它在以下情况下设置了所有必要的环境变量打开。这样你就不必编辑你的 PATH 变量。
This shortcut runs the following:
此快捷方式运行以下内容:
%comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
%comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
If it's not convenient to use the shortcut, perhaps you could learn something of use from investigating what this .bat file does?
如果使用快捷方式不方便,也许您可以通过研究这个 .bat 文件的作用来了解一些有用的东西?
回答by Zhang Teng
I met same error,it is because we installed a vs2010 x86 version to a x64 system...
我遇到了同样的错误,这是因为我们在 x64 系统上安装了 vs2010 x86 版本...
Open two folders:
打开两个文件夹:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
You will find two cvtres.exe. Righ click, select Properties, then Details. Delete the older version, and cmake will work well.
I hope this may help you.
你会发现两个cvtres.exe。右键单击,选择“属性”,然后选择“详细信息”。删除旧版本,cmake 将运行良好。我希望这可以帮助你。
Thanks to "zhoudongao" @ http://bbs.csdn.net/topics/390121452?page=1#post-394768226.
感谢“zhoudongao” @ http://bbs.csdn.net/topics/390121452?page=1#post-394768226。
回答by quags
I know this is a bit dated but if anyone's looking for a way to get compiler running from command line; here's what I did to get it running.
我知道这有点过时了,但是如果有人正在寻找一种从命令行运行编译器的方法;这是我为让它运行所做的工作。
I'm using Win7 32bit and Visual Studio 2010. I created a small batch file in C:\Windows. open cmd prompt at C:\Windows as admin, then type the following:
我使用的是 Win7 32 位和 Visual Studio 2010。我在 C:\Windows 中创建了一个小批处理文件。以管理员身份在 C:\Windows 中打开 cmd 提示符,然后键入以下内容:
copy con cl.bat
@"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32" %1 %2 %3 %4 %5 %6
@"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\cl" %1 %2 %3 %4 %5 %6
then press f6 and hit enter again.
然后按 f6 并再次按 Enter。
Obviously the path you will use is the install path to where you installed Visual Studio.
显然,您将使用的路径是您安装 Visual Studio 的安装路径。
You now have working command line compiler from any location or directory in windows. To test this go to desktop and open cmd prompt as admin; I prefer to use Ctrl+Shift and right click then choose open command prompt here. At command prompt type "cl" (without quotes) and hit enter. you will see a message "Setting enviroment for using Microsoft Visual Studio 2010 x86 tools"
您现在可以从 Windows 中的任何位置或目录使用命令行编译器。要进行测试,请转到桌面并以管理员身份打开 cmd 提示符;我更喜欢使用 Ctrl+Shift 并右键单击,然后在此处选择打开命令提示符。在命令提示符下键入“cl”(不带引号)并按回车键。您将看到一条消息“设置使用 Microsoft Visual Studio 2010 x86 工具的环境”
type "cl" and hit enter again and you will get your compiler info. you're all set to compile.
输入“cl”并再次按回车键,您将获得编译器信息。你已经准备好编译了。
enjoy!
请享用!
回答by avtomaton
Maybe it will help somebody...
也许它会帮助某人......
I solved this problem by adding
我通过添加解决了这个问题
PATH += %PATH_TO_VS_IN_YOUR_SYSTEM%/Common7/IDE;
to nvcc.profile.
到nvcc.profile。
Of course, %PATH_TO_VS_IN_YOUR_SYSTEM%is actual path to Visual Studioin your system.
当然,%PATH_TO_VS_IN_YOUR_SYSTEM%是系统中Visual Studio 的实际路径。
回答by Oliver Zendel
Old, but maybe still valid:
旧的,但也许仍然有效:
For me "C:\Windows\System32" somehow got missing from the PATH variable.
对我来说,“C:\Windows\System32”不知何故从 PATH 变量中丢失了。
Adding the missing folder to the path solved this error. See also VS2010 command prompt gives error : Cannot determine the location of the VS Common Tools folder
将丢失的文件夹添加到路径解决了这个错误。另请参阅VS2010 命令提示符给出错误:无法确定 VS 通用工具文件夹的位置
回答by the accountant
if you try to run the tools from the windows cmd.exe directly then you need to set the environments by running the vcvars32.batfile which will set the environment for you. instead you can run the visual studio command prompt which will run vcvars32.bat automatically. if you still have the problem then it's definitely the famous path variable problem.
如果您尝试直接从 windows cmd.exe 运行这些工具,那么您需要通过运行vcvars32.bat文件来设置环境,该文件将为您设置环境。相反,您可以运行 Visual Studio 命令提示符,它将自动运行 vcvars32.bat。如果您仍然有问题,那么这绝对是著名的路径变量问题。
make sure the "path"variable in the environment has the "c:\windows\system32\"value added to it , because the .bat file will need it to configure the VC tools.
确保环境中的“path”变量添加了“c:\windows\system32\”值,因为 .bat 文件需要它来配置 VC 工具。
this problem and the like usually happen because of installing many development platforms on the machine which might probably change the path variable.
这个问题和类似的问题通常是因为在机器上安装了许多开发平台,这可能会改变路径变量。
check this.. https://schrievkrom.wordpress.com/2011/01/25/error-cannot-determine-the-location-of-the-vs-common-tools-folder/

