一、问题现象
二、解决办法
1、原因
2、一种临时解决办法
3、最终解决办法
C:\Program Files\Microsoft Visual Studio 10.0\VC\include;$(IncludePath)
C:\Program Files\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\lib;$(ReferencePath)
C:\Program Files\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\lib;$(LibraryPath)
C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc;C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl;C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfcm;C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src;$(SourcePath)
三、参考资料
http://social.msdn.microsoft.com/Forums/en-CA/vcgeneral/thread/ca399aec-1b5e-41a3-9cd5-76a74420f940
Right, if you notice the path to your compiler it is actually picking up the VC9 compiler on your system. This is why you are getting this problem. This is a known bug in the environment.
What you can try is
1) Open your Visual Studio Command Prompt (Can get to it through Start->All Programs->Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio Command Prompt)
2) Run DevEnv /ResetUserData wait for it to finish (it may take a while)
3) Open Visual Studio itself and it will give you the same window as when you first run Visual Studio. Make sure you deselect Migrate my eligable settings checkbox before you select your configuration and then select Start Visual Studio.
4) Open your project and try again.
If it still fails then it is likely that something was saved into the project itself. In this case go to Project Properties->Configuration Properties->VC++ Directories and replace set each of the Paths to the Following
Executable Directories to $(ExectablePath)
Include Directories to $(IncludePath)
Reference Directories to $(ReferencePath)
Library Directories to $(LibraryPath)
Source Directories to $(SourcePath)
Exclude Directories to $(ExcludePath)
Please note you need to keep the exact formatting, so when you locate Executable Directories, in the box on the right replace the entire contents with $(ExecutablePath) for example. If you do that you will put the project specific settings to the default too and (hopefully) will fix everything.
----------------------------------------
It was still inherited even after you reset your environment?
Hmm, ok.
Open up Property Manager, if you selected the VC configuration then it should be on the left automatically. If not, you can find it either under View->Property Manager (it is near the bottom) or View->Other Windows->Property Manager. You will need a VC project loaded. In Property Manager, under <Project Name>->Debug | Win32 look for Microsoft.Cpp.Win32.User.
Right click on this and select properties. Go to Common Properties->VC++ Directories and check these out. But since these should inherit from the others directly then the best you can do is override the paths yourself here. The only thing that I could think of to override these is if you have VSINSTALLDIR and VCINSTALLDIR set on a global scale.
Could you look at one final thing, if you go to Control Panel->System->Advanced system settings and click on the Environment Variables button. Under either of these can you find VCINSTALLDIR and VSINSTALLDIR set to anything?