最近在做VC开发的过程中遇到了这个烦人的问题,查阅了很多资料也没有一个统一的说法,所以把所有可能出现的情况都总结一下,供以后参考。
症状: fatal error C1083: Cannot open compiler intermediate file:“C:/WINDOWS/Temp/xxxx” No such file or directory 或 致命错误 C1083: 无法打开编译器中间文件:
原因之一:有可能是环境变量设置不对。user用户变量和system变量TEMP和TMP的变量值都为%SystemRoot%/TEMP ,在正常机器上,这是没有问题的,但是有的用户机器的系统盘是手动更改成C盘的,本来应该为E盘。 解决办法:将user用户变量和system变量TEMP和TMP的变量值都改为C:/WINDOWS/Temp
原因之二:和预编译头的设置有关。 解决办法:打开Settings对话框,左边的Settings For中选中Release,底下的TreeView中选中StdAfx.cpp,右边选中C/C++标签页,Category选Precompiled Headers,底下选Create precompiled header,Through header填StdAfx.h。左边的TreeView中依次选中工程中其他所有的cpp,Precompiled Headers都选中Use precompiled header file,Through header填StdAfx.h。最后,“OK”、“Rebuild All”。
原因三:该错误是由 TMP 环境变量的末尾分号引起的。例如:TMP=C:/TMP; 解决办法:从命令行设置 TMP 环境变量正确方法是,如下所示:C:/>SET TMP=C:/TMP 非常重要的环境字符串不能结束用分号 (;),因为编译器将中间文件名追加到 TMP 路径。 通过从路径中删除分号,编译器可以正确地创建该文件。 in addition,TMP variable should be fully qualified path and not relative path。C:TMP for example may cause compiler to issue similar errors,but C:/TMP will always work correctly。 TMP environment variable also should be set to that has sufficient space for compiler 's temporary files drive。
另附上Windows帮助文档片段:
RESOLUTION +++++++++++++++++++++++++++++++++++++++++ 使用vc的人经常遇到fatal error C1083: Cannot open precompiled header file: 'Debug/xxx.pch': No such file or directory,
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/hbu_dcf/archive/2010/01/29/5268252.aspx |
Visual C++ 中fatal error C1083的解决办法
Visual C++ 中fatal error C1083的解决办法