关于这个1083的错误,是我目前工作的内容之一,因为该工作还没完工,所以我还没发表的,这个工作太庞大了,要过一段时间才能完成,不过呢。1083的内容为现在就可以报告给你看看,我还做了翻译工作,有不对之处,请多多指教。
Fatal Error C1083:
Cannot open filetype file: 'file': message
The compiler generates a C1083 error when it can’t find a file. Here are the common reasons why the compiler generates this error.
The specified file name is wrong
The name of a file may be mistyped. For example,
#include <algorithms.h>
might not find the file you intend. There is a Standard C++ Library header file named algorithms that does not have a .h file name extension. It would not be found by this include directive. To fix this issue, verify that the correct file name is entered.
Certain C Runtime Library headers are located in a subdirectory of the standard include directory. For example, to include sys\types.h, you must include the sys subdirectory name in the include directive:
#include <sys\types.h>
The file is not included in the compiler search path
The compiler cannot find the file by using the search rules that are indicated by an include or import directive. For example, a header file name that is enclosed by quotation marks
#include "myincludefile.h"
tells the compiler to look for the file in the same directory that contains the source file first, and then look in other locations specified by the build environment. If the quotation marks contain an absolute path, the compiler only looks for the file at that location. If the quotation marks contain a relative path, the compiler looks for the file in the directory relative to the source directory. If the name is enclosed by angle brackets.
#include <stdio.h>
the compiler follows a search path that is defined by the build environment, the /I compiler option, the /X compiler option, and the INCLUDE environment variable. For more information, including specific details about the search order used to find a file, see #include Directive (C/C++) and #import Directive.
Even when header files are listed in Solution Explorer as part of a project, the files are only found by the compiler when they are referred to by an include or import directive and are located on a directory search path. Different kinds of builds might use different search paths. The /X compiler option can be used to exclude directories from the include file search path. This enables different builds to use different include files that have the same name, but are kept in different directories. This is an alternative to conditional compilation by using preprocessor commands. For more information about the /X compiler option, see /X (Ignore Standard Include Paths).
When the compiler is invoked on the command line, environment variables are often used to specify search paths. If the search path described by the INCLUDE environment variable is not set correctly, a C1083 error is generated. For more information about how to use environment variables, see How to: Use Environment Variables in a Build.
To fix this issue, correct the path that the compiler uses to search for the included or imported file. A new project uses default search paths. You may have to modify the path to add a directory for your project. If you are compiling on the command line, set the INCLUDE environment variable or the /I compiler option to specify the path of the file. To set the include directory path in Visual Studio, open the project’s Property Pages dialog box, expand Configuration Properties and VC++ Directories, and then edit the Include Directories value. For more information about the per-user and per-project directories searched by the compiler in Visual Studio, see VC++ Directories Property Page. For more information about the /I compiler option, see /I (Additional Include Directories).
The wrong version of a file name is included
A C1083 error can also indicate that the wrong version of a file is included. For example, a build could include the wrong version of a file that has an include directive for a header file that is not intended for that build. When the header file is not found, the compiler generates a C1083 error. The fix for this problem is to use the correct file, not to add the header file or directory to the build.
The precompiled headers are not yet precompiled
When a project is configured to use precompiled headers, the relevant .pch files have to be created so that files that use the header contents can be compiled. For example, the stdafx.cpp file is automatically created in the project directory for new MFC projects. Compile that file first to create the precompiled header files. (In the typical build process design, this is done automatically.) For more information, see Creating Precompiled Header Files.
Additional causes
The file uses managed code, but the compiler option /clr is not specified. For more information, see /clr (Common Language Runtime Compilation).
The file is compiled by using a different /analyze compiler option setting than is used to precompile the headers. (When the headers for a project are precompiled, all should use the same /analyze settings.) For more information, see /analyze (Code Analysis).
The file, the directory, or the disk is read-only.
Access permissions for the file or the directory are not granted.
There are not enough file handles. Close some applications and then recompile. This condition is unusual under typical circumstances. However, it can occur when large projects are built on a computer that has limited physical memory.
The following example generates a C1083 error.
// C1083.cpp
// compile with: /c
#include "test.h"
// C1083 test.h does not exist
#include "stdio.h"
// OK
For information about how to build C/C++ projects in the IDE or on the command line, and information about setting environment variables, see Building C/C++ Programs.
See Also
MSBuild Properties
无法打开文件类型文件:'文件':消息
编译器无法找到文件时会生成C1083错误。 以下是编译器产生此错误的常见原因。
指定的文件名是错误的
文件的名称可能错误输入。 例如,
#include <algorithms.h>
可能找不到你想要的文件。 有一个名为算法的标准C ++库头文件没有.h文件扩展名。 它不会被这个包含指令找到。 要解决此问题,请验证是否输入了正确的文件名。
某些C运行时库标头位于标准包含目录的子目录中。 例如,要包含sys \ types.h,您必须在include指令中包含sys子目录名称:
#include <sys\types.h>
该文件不包含在编译器搜索路径中
编译器无法使用包含或导入指令指示的搜索规则查找文件。 例如,用引号括起来的头文件名称
#include "myincludefile.h"
告诉编译器先在包含源文件的同一目录中查找文件,然后查看由构建环境指定的其他位置。 如果引号包含绝对路径,则编译器仅在该位置查找文件。 如果引号包含相对路径,编译器将在相对于源目录的目录中查找该文件。 如果名称用尖括号括起来.
#include <stdio.h>
编译器遵循由构建环境,/ I编译器选项,/ X编译器选项和INCLUDE环境变量定义的搜索路径。 有关详细信息(包括有关用于查找文件的搜索顺序的特定详细信息),请参阅#include指令(C / C ++)和#import指令。
即使在解决方案资源管理器中将头文件列为项目的一部分时,只有编译器在被include或import指令引用并位于目录搜索路径中时才能找到这些文件。 不同种类的构建可能使用不同的搜索路径。 / X编译器选项可用于从包含文件搜索路径中排除目录。 这使不同的构建可以使用具有相同名称但保存在不同目录中的不同包含文件。 这是使用预处理器命令进行条件编译的替代方法。 有关/ X编译器选项的更多信息,请参阅/ X(忽略标准包含路径)。
当在命令行中调用编译器时,通常会使用环境变量来指定搜索路径。 如果由INCLUDE环境变量描述的搜索路径设置不正确,则会生成C1083错误。 有关如何使用环境变量的更多信息,请参阅如何:在构建中使用环境变量。
要解决此问题,请更正编译器用于搜索包含或导入文件的路径。 新项目使用默认搜索路径。 您可能需要修改路径以为项目添加目录。 如果要在命令行上编译,请设置INCLUDE环境变量或/ I编译器选项以指定文件的路径。 要在Visual Studio中设置包含目录路径,请打开项目的“属性页”对话框,展开“配置属性”和“VC ++目录”,然后编辑“包含目录”值。 有关Visual Studio中的编译器搜索的每个用户和每个项目目录的更多信息,请参阅VC ++目录属性页。 有关/ I编译器选项的更多信息,请参阅/ I(其他包含目录)。
包括文件名的错误版本
C1083错误也可能表明包含文件的错误版本。 例如,构建版本可能包含错误版本的文件,该文件具有不适用于该版本的头文件的include指令。 当找不到头文件时,编译器会生成一个C1083错误。 解决此问题的方法是使用正确的文件,而不是将头文件或目录添加到构建中。
预编译头文件尚未预编译
当项目配置为使用预编译头文件时,必须创建相关的.pch文件,以便可以编译使用头文件内容的文件。 例如,stdafx.cpp文件会自动在项目目录中为新的MFC项目创建。 首先编译该文件以创建预编译的头文件。 (在典型的构建过程设计中,这是自动完成的。)有关更多信息,请参阅创建预编译头文件。
其他原因:
该文件使用托管代码,但未指定编译器选项/ clr。 有关更多信息,请参阅/ clr(公共语言运行时编译)。
该文件通过使用与用于预编译头文件不同的/分析编译器选项设置进行编译。 (当一个项目的头文件被预编译时,所有的都应该使用相同的/分析设置。)有关更多信息,请参阅/ analyze(代码分析)
文件,目录或磁盘是只读的。
不授予文件或目录的访问权限。
没有足够的文件句柄。 关闭一些应用程序,然后重新编译。 这种情况在典型情况下是不寻常的。 但是,如果在物理内存有限的计算机上构建大型项目,则可能会发生这种情况。
以下示例会生成C1083错误。
// C1083.cpp
// compile with: /c
#include "test.h"
// C1083 test.h does not exist
#include "stdio.h"
// OK
有关如何在IDE或命令行中构建C / C ++项目的信息以及有关设置环境变量的信息,请参阅构建C / C ++程序。
也可以看看
MSBuild属性