VC编译的问题。

zhoyan 2002-12-16 01:23:40
最近这几天,我编译时总是不能通过,系统会报错:
e:\vc_practise\bmpprint\xxxview.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Debug/xxx.pch': No such file or directory
点击这个错误,会指向xxxview.cpp中的#include "stdafx.h"语句
即使我只是自动生成一个MFC,不作任何改动也是如此。可我打开以前做的一些程序却没有这个问题(这排除了VC坏掉的可能)。到底是哪里有问题?
...全文
62 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
ruihuahan 2002-12-16
  • 打赏
  • 举报
回复
rebuild all试试
bojinyu 2002-12-16
  • 打赏
  • 举报
回复
pch是预编译头文件,rebuild all可以解决
cbc 2002-12-16
  • 打赏
  • 举报
回复
出现这样的问题只能这样啊,这也不废时间呀
abrams 2002-12-16
  • 打赏
  • 举报
回复
rebuild all试试
cbc 2002-12-16
  • 打赏
  • 举报
回复
你没编译整个工程,就对单个文件进行编译了

先按F5或ctrl+F5对整个工程编译
zhoyan 2002-12-16
  • 打赏
  • 举报
回复
我试了删掉debug文件夹,并rebuild all。问题解决了。
但是难道以后我编译时都要这么用rebuild all了吗?郁闷啊!!!
zhou80bin 2002-12-16
  • 打赏
  • 举报
回复
删掉pch文件
nscboy 2002-12-16
  • 打赏
  • 举报
回复
删掉DEBUG,release文件夹和*.opt,*.ncb,然后重新完全编译
GZCompiler 2002-12-16
  • 打赏
  • 举报
回复
把那个pch文件删掉。
kiko_lee 2002-12-16
  • 打赏
  • 举报
回复
估计好多都是和系统有关,有时候系统很长时间没有装了,而且里面装了很多其他的东西,vc都会莫名其妙的出问题,

不过习惯就好了 :)
kiko_lee 2002-12-16
  • 打赏
  • 举报
回复
呵呵,楼上的哥们真厉害哦,到处去寻觅msdn来给大家学习
puyinghua 2002-12-16
  • 打赏
  • 举报
回复
vc问题吧, 我的还更邪乎, 无法插入新类! 插入后说是无法打开新插入类的.h及.cpp文件, 要我去硬盘上把生成的.h及.cpp文件删除后重插,才Ok, 近来就是怪啊
Ariesman 2002-12-16
  • 打赏
  • 举报
回复
呵呵,在这里看MSDN了:)
qing_li73 2002-12-16
  • 打赏
  • 举报
回复
Fatal Error C1083
Cannot open filetype file: 'file': message

An error occurred opening the specified file.

Tips

This error can occur if the file, subdirectory, or disk on which it resides is read-only. In this case, make the file writable or move the file to a writable disk. See your operating system documentation for information on removing the read-only attribute from a file.


This error may be caused by not having enough file handles. Close some open applications and recompile.


Trying to open a file or directory for which you do not have permission can cause this error. Move the file to a directory where you do have access privileges, or ask your network administrator to grant you access to the file.


If an include file could not be opened, check that the INCLUDE environment variable is set correctly and that the name of the file is spelled correctly.


Using double quotation marks around a complete path specification in a #include directive causes the standard directories to NOT be searched. See The #include Directive in the Preprocessor Reference for more information.
The #include Directive
The #include directive tells the preprocessor to treat the contents of a specified file as if those contents had appeared in the source program at the point where the directive appears. You can organize constant and macro definitions into include files and then use #include directives to add these definitions to any source file. Include files are also useful for incorporating declarations of external variables and complex data types. You only need to define and name the types once in an include file created for that purpose.

Syntax

#include "path-spec"

#include <path-spec>

The path-spec is a filename optionally preceded by a directory specification. The filename must name an existing file. The syntax of the path-spec depends on the operating system on which the program is compiled.

Both syntax forms cause replacement of that directive by the entire contents of the specified include file. The difference between the two forms is the order in which the preprocessor searches for header files when the path is incompletely specified.

Syntax Form Action
Quoted form This form instructs the preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of whatever files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable.
Angle-bracket form This form instructs the preprocessor to search for include files first along the path specified by the /I compiler option, then along the path specified by the INCLUDE environment variable.


The preprocessor stops searching as soon as it finds a file with the given name. If you specify a complete, unambiguous path specification for the include file between two sets of double quotation marks (" "), the preprocessor searches only that path specification and ignores the standard directories.

If the filename enclosed in double quotation marks is an incomplete path specification, the preprocessor first searches the “parent” file’s directory. A parent file is the file containing the #include directive. For example, if you include a file named file2 within a file named file1, file1 is the parent file.

Include files can be “nested”; that is, an #include directive can appear in a file named by another #include directive. For example, file2, above, could include file3. In this case, file1 would still be the parent of file2 but would be the “grandparent” of file3.

When include files are nested, directory searching begins with the directories of the parent file and then proceeds through the directories of any grandparent files. Thus, searching begins relative to the directory containing the source currently being processed. If the file is not found, the search moves to directories specified by the /I compiler option. Finally, the directories specified by the INCLUDE environment variable are searched.

The following example shows file inclusion using angle brackets:

#include <stdio.h>

This example adds the contents of the file named STDIO.H to the source program. The angle brackets cause the preprocessor to search the directories specified by the INCLUDE environment variable for STDIO.H, after searching directories specified by the /I compiler option.

The following example shows file inclusion using the quoted form:

#include "defs.h"

This example adds the contents of the file specified by DEFS.H to the source program. The double quotation marks mean that the preprocessor searches the directory containing the parent source file first.

Nesting of include files can continue up to 10 levels. Once the nested #include is processed, the preprocessor continues to insert the enclosing include file into the original source file.

Microsoft Specific

To locate includable source files, the preprocessor first searches the directories specified by the /I compiler option. If the /I option is not present or fails, the preprocessor uses the INCLUDE environment variable to find any include files within angle brackets. The INCLUDE environment variable and /I compiler option can contain multiple paths separated by semicolons (;). If more than one directory appears as part of the /I option or within the INCLUDE environment variable, the preprocessor searches them in the order in which they appear.

For example, the command

CL /ID:\MSVC\INCLUDE MYPROG.C

causes the preprocessor to search the directory D:\MSVC\INCLUDE for include files such as STDIO.H. The commands

SET INCLUDE=D:\MSVC\INCLUDE
CL MYPROG.C

have the same effect. If both sets of searches fail, a fatal compiler error is generated.

If the filename is fully specified for an include file with a path that includes a colon (for example, F:\MSVC\SPECIAL\INCL\TEST.H), the preprocessor follows the path.

For include files specified as #include "path-spec", directory searching begins with the directory of the parent file and then proceeds through the directories of any grandparent files. Thus, searching begins relative to the directory containing the source file containing the #include directive being processed. If there is no grandparent file and the file has not been found, the search continues as if the filename were enclosed in angle brackets.

END Microsoft Specific

16,470

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧