VS 2010 无法打开源文件“字符串" [英] VS 2010 Cannot open source file "string"

查看:56
本文介绍了VS 2010 无法打开源文件“字符串"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

突然间,我的 VS 2010 项目中的 Intellisense 开始变得疯狂.

All of the sudden, the Intellisense in my VS 2010 project started going nuts.

一切都正确构建,但它不再能找到基本的 C++ 头文件,如 string、map 等.它不再识别 std:: 命名空间,而且它通常只是出问题了.

Everything builds correctly, but it can no longer find basic C++ header files like string, map, etc. It no longer recognizes the std:: namespace, and it generally is just going haywire.

代码仍然可以编译,但无论我做什么我都无法让 Intellisense 再次正常工作.

The code still compiles, but no matter what I do I can't get the Intellisense to work properly again.

我发现的最接近的现有问题在这里:VS 2010 错误 - 无法打开文件iostream"

The closest existing question I found was here: VS 2010 error - cannot open file "iostream"

但是那个解决方案对我不起作用.

but that solution didn't work for me.

我安装了 2012 和 2010,所以我想知道一个是否搞砸了另一个.不过,我为此使用了 2010.

I have both 2012 and 2010 installed, so I'm wondering if one messed up the other. I'm using 2010 for this though.

推荐答案

好的,我想通了.它与此有关:VS 2010 错误 - 无法打开文件iostream";我只需要稍微改变一下.

Ok, I figured it out. It was related to this: VS 2010 error - cannot open file "iostream"; I just had to change it a bit.

1) 打开属性对话框.我不清楚这在那个答案中的实际含义.我只是右键单击我的项目并选择属性.

1) Open the properties dialog. It wasn't clear to me what this actually meant in that answer. I was just right clicking on my project and selecting properties.

正确的做法是选择解决方案下的单个子项目.选中后,将鼠标移到解决方案资源管理器的左上角.当您将鼠标悬停在该图标上时,您应该会看到属性".打开那个.

The correct thing to do is to select the individual sub-project underneath your solution. With that selected, take your mouse to the top left of the solutions explorer. When you hover over that icon, you should see "Properties". Open that.

2) 打开目录属性.选择配置属性下的 VC++ 目录选项.

2) Open the directory properties. Select the VC++ Directories option under Configuration Properties.

3) 不知何故,所有这些值都被清除了.要修复它,再次与此处的答案密切相关:VS 2010 错误 - 无法打开文件iostream",我做了以下事情:

3) Somehow for me, all these values had been cleared. To fix it, again closely related to the answer here: VS 2010 error - cannot open file "iostream", I did the following:

2a) 对于每个目录值(例如可执行目录),选择下拉列表并单击编辑...

2a) For each of the directory values (e.g. Executable directories), select the drop down and click Edit...

2b) 取消选择从父级继承

2b) Deselect the Inherit from parent

2c) 单击确定.您应该在生成的编辑"框中看不到任何变化.

2c) Click ok. You should see no change in the resulting Edit box.

2d) 再次单击编辑....

2d) Click Edit... again.

2e) 不做任何更改点击确定.

2e) Click ok without changing anything.

2f) 现在你应该看到例如$(ExecutablePath) 用于可执行目录.

2f) Now you should see e.g. $(ExecutablePath) for Executable Directories.

g) 对每个目录条目重复,所以最后,可执行目录将设置为 $(ExecutablePath),包含目录将设置为 $(IncludePath) 等.

g) Repeat for each of the directory entries so at the end, Executable Directories will be set to $(ExecutablePath), Include Directories will be set to $(IncludePath), etc.

h) 最后在主对话框中单击应用",然后单击确定".

h) Finally click Apply and then Ok in the master dialog.

这样做之后,我的 Intellisense 终于再次工作了.

After doing this my Intellisense finally worked again.

这篇关于VS 2010 无法打开源文件“字符串"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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