Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS 2010 Cannot open source file "string"

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

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.

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

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

but that solution didn't work for me.

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

like image 346
Ross117 Avatar asked Oct 08 '14 18:10

Ross117


1 Answers

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) 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) Open the directory properties. Select the VC++ Directories option under Configuration Properties.

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) For each of the directory values (e.g. Executable directories), select the drop down and click Edit...

2b) Deselect the Inherit from parent

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

2d) Click Edit... again.

2e) Click ok without changing anything.

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

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) Finally click Apply and then Ok in the master dialog.

After doing this my Intellisense finally worked again.

like image 182
Ross117 Avatar answered Oct 19 '22 17:10

Ross117