- Неустранимая ошибка C1083 Fatal Error C1083
- Указано неверное имя файла The specified file name is wrong
- Файл не включен в путь поиска включаемых файлов The file is not included in the include search path
- Проблемы с библиотекой сторонних производителей и vcpkg Third-party library issues and vcpkg
- Файл находится в проекте, но не в пути поиска включаемых файлов The file is in your project, but not the include search path
- Не задана среда командной строки INCLUDE или LIB The command line INCLUDE or LIB environment is not set
- Возможно, файл заблокирован или используется The file may be locked or in use
- Включена неправильная версия имени файла The wrong version of a file name is included
- Предкомпилированные заголовки еще не скомпилированы The precompiled headers are not yet precompiled
- Дополнительные причины Additional causes
- Пример Example
Неустранимая ошибка C1083 Fatal Error C1083
Не удается открыть файл filetype : «файл«: сообщение Cannot open filetype file: ‘file‘: message
Компилятор создает ошибку C1083, когда не удается найти требуемый файл. The compiler generates a C1083 error when it can’t find a file it requires. Эта ошибка имеет несколько возможных причин. There are many possible causes for this error. Наиболее распространенными причинами являются неверный путь поиска include или отсутствующие или неправильно именованные файлы заголовков, но другие типы файлов и проблемы могут также вызвать C1083. An incorrect include search path or missing or misnamed header files are the most common causes, but other file types and issues can also cause C1083. Ниже приведены некоторые распространенные причины, по которым компилятор создает эту ошибку. Here are some of 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,
Некоторые заголовки библиотеки времени выполнения C расположены в подкаталоге стандартного каталога включения. Certain C Runtime Library headers are located in a subdirectory of the standard include directory. Например, чтобы включить sys/types.h , необходимо включить sys имя подкаталога в #include директиву: For example, to include sys/types.h , you must include the sys subdirectory name in the #include directive:
Файл не включен в путь поиска включаемых файлов The file is not included in the include search path
Компилятору не удается найти файл, используя правила поиска, которые указаны в директиве #include или #import . The compiler cannot find the file by using the search rules that are indicated by an #include or #import directive. Например, если имя файла заголовка заключено в кавычки, For example, when a header file name is enclosed by quotation marks,
Это указывает компилятору искать файл в том же каталоге, который содержит исходный файл, а затем искать в других местах, заданных средой сборки. this 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,
Компилятор следует пути поиска, который определяется средой сборки, /I параметром компилятора, /X параметром компилятора и переменной среды include . 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. Дополнительные сведения, включая конкретные сведения о порядке поиска файлов, см. в разделе директива #include (C/C++) и Директива #import. For more information, including specific details about the search order used to find a file, see #include Directive (C/C++) and #import Directive.
Если включаемые файлы находятся в другом каталоге относительно исходного каталога и в директивах Include используется относительный путь, то вместо угловых скобок следует использовать двойные кавычки. If your include files are in another directory relative to your source directory, and you use a relative path in your include directives, you must use double quotes instead of angle brackets. Например, если файл заголовка myheader.h находится в подкаталоге именованных заголовков проекта, в этом примере не удается найти файл и вызывается C1083: For example, if your header file myheader.h is in a subdirectory of your project sources named headers, then this example fails to find the file and causes C1083:
но этот пример работает: but this example works:
Относительные пути также можно использовать с каталогами в пути поиска include. Relative paths can also be used with directories on the include search path. При добавлении каталога в переменную среды include или в путь к каталогам включаемых элементов в Visual Studio не следует добавлять часть пути в директивы include. If you add a directory to the INCLUDE environment variable or to your Include Directories path in Visual Studio, do not also add part of the path to the include directives. Например, если заголовок находится в папке \path\example\headers\myheader.h , и вы добавляете \path\example\headers\ путь к каталогам включаемых файлов в Visual Studio, но #include директива ссылается на файл как на For example, if your header is located at \path\example\headers\myheader.h , and you add \path\example\headers\ to your Include Directories path in Visual Studio, but your #include directive refers to the file as
Затем файл не найден. then the file is not found. Используйте правильный путь относительно каталога, указанного в пути поиска включаемых данных. Use the correct path relative to the directory specified in the include search path. В этом примере можно изменить путь поиска include на \path\example\ или удалить headers\ сегмент пути из #include директивы. In this example, you could change the include search path to \path\example\ , or remove the headers\ path segment from the #include directive.
Проблемы с библиотекой сторонних производителей и vcpkg Third-party library issues and vcpkg
Если вы видите эту ошибку при попытке настроить библиотеку стороннего производителя в рамках сборки, рассмотрите возможность vcpkg установки и сборки библиотеки с помощью диспетчера пакетов C++. If you see this error when you are trying to configure a third-party library as part of your build, consider using vcpkg , a C++ package manager, to install and build the library. vcpkg поддерживает большой и растущей список библиотек сторонних производителейи задает все свойства конфигурации и зависимости, необходимые для успешной сборки в рамках проекта. vcpkg supports a large and growing list of third-party libraries, and sets all the configuration properties and dependencies required for successful builds as part of your project.
Файл находится в проекте, но не в пути поиска включаемых файлов The file is in your project, but not the include search path
Даже если файлы заголовков перечислены в Обозреватель решений в составе проекта, эти файлы обнаруживаются компилятором только при условии, что они ссылаются на #include #import директиву или в исходном файле и находятся в пути поиска include. 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 in a source file, and are located in an include search path. Для различных типов построений могут использоваться разные пути поиска. Different kinds of builds might use different search paths. /X Параметр компилятора можно использовать для исключения каталогов из пути поиска include. The /X compiler option can be used to exclude directories from the include search path. Это позволяет использовать для разных построений разные файлы include, которые имеют одно имя, но расположены в разных каталогах. 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. Дополнительные сведения о /X параметре компилятора см. в разделе /X (игнорировать стандартные пути включаемых файлов). For more information about the /X compiler option, see /X (Ignore Standard Include Paths).
Чтобы устранить эту проблему, исправьте путь, используемый компилятором для поиска включаемого или импортируемого файла. To fix this issue, correct the path that the compiler uses to search for the included or imported file. В новом проекте используются пути поиска include по умолчанию. A new project uses default include search paths. Может потребоваться изменить путь поиска include, чтобы добавить каталог для проекта. You may have to modify the include search path to add a directory for your project. При компиляции в командной строке добавьте путь к переменной среды include или /I параметр компилятора, чтобы указать путь к файлу. If you are compiling on the command line, add the path to the INCLUDE environment variable or the /I compiler option to specify the path to the file.
Чтобы задать путь к каталогу включения в Visual Studio, откройте диалоговое окно страницы свойств проекта. To set the include directory path in Visual Studio, open the project’s Property Pages dialog box. Выберите каталоги VC + + в свойствах конфигурации в левой области, а затем измените свойство включаемые каталоги . Select VC++ Directories under Configuration Properties in the left pane, and then edit the Include Directories property. Дополнительные сведения о каталогах для отдельных пользователей и проектов, поиск которых выполняется компилятором в Visual Studio, см. в разделе Страница свойств каталогов VC + +. For more information about the per-user and per-project directories searched by the compiler in Visual Studio, see VC++ Directories Property Page. Дополнительные сведения о /I параметре компилятора см. в разделе /I (дополнительные каталоги включаемых данных). For more information about the /I compiler option, see /I (Additional Include Directories).
Не задана среда командной строки INCLUDE или LIB The command line INCLUDE or LIB environment is not set
Если компилятор вызывается из командной строки, для указания путей поиска часто используются переменные среды. When the compiler is invoked on the command line, environment variables are often used to specify search paths. Если путь поиска, описанный в переменной среды include или lib , задан неправильно, может быть сформирована ошибка C1083. If the search path described by the INCLUDE or LIB environment variable is not set correctly, a C1083 error can be generated. Мы настоятельно рекомендуем использовать ярлык командной строки разработчика, чтобы задать базовую среду для сборок с командной строкой. We strongly recommend using a developer command prompt shortcut to set the basic environment for command line builds. Дополнительные сведения см. в разделе сборка C/C++ в командной строке. For more information, see Build C/C++ on the Command Line. Дополнительные сведения об использовании переменных среды см. в разделе инструкции. Использование переменных среды в сборке. For more information about how to use environment variables, see How to: Use Environment Variables in a Build.
Возможно, файл заблокирован или используется The file may be locked or in use
Если для изменения или доступа к файлу используется другая программа, файл может быть заблокирован. If you are using another program to edit or access the file, it may have the file locked. Попробуйте закрыть файл в другой программе. Try closing the file in the other program. Иногда другая программа может быть самой Visual Studio, если используются параметры параллельной компиляции. Sometimes the other program can be Visual Studio itself, if you are using parallel compilation options. Если отключить параметр параллельной сборки, то эта ошибка исчезнет, а это проблема. If turning off the parallel build option makes the error go away, then this is the problem. Эта проблема также может быть вызвана другими системами параллельной сборки. Other parallel build systems can also have this issue. Будьте внимательны при задании зависимостей файлов и проектов, чтобы порядок сборки был правильным. Be careful to set file and project dependencies so build order is correct. В некоторых случаях рекомендуется создать промежуточный проект для принудительного создания последовательности зависимостей для общего файла, который может быть создан несколькими проектами. In some cases, consider creating an intermediate project to force build dependency order for a common file that may be built by multiple projects. Иногда антивирусные программы временно блокируют недавно измененные файлы для проверки. Sometimes antivirus programs temporarily lock recently changed files for scanning. Если возможно, рассмотрите возможность исключения каталогов сборки проекта из антивирусного сканера. If possible, consider excluding your project build directories from the antivirus scanner.
Включена неправильная версия имени файла The wrong version of a file name is included
Ошибка C1083 также может указывать на включение неверной версии файла. A C1083 error can also indicate that the wrong version of a file is included. Например, построение может включать неверную версию файла, содержащего директиву #include для файла заголовка, который не предназначен для данного построения. 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. Например, некоторые файлы могут применяться только к сборкам x86 или для отладки сборок. For example, certain files may only apply to x86 builds, or to Debug builds. Если файл заголовка не найден, компилятор выдает ошибку C1083. 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
Если проект настроен для использования предварительно скомпилированных заголовков, необходимо .pch создать соответствующие файлы, чтобы можно было скомпилировать файлы, использующие содержимое заголовка. 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. Например, pch.cpp файл ( stdafx.cpp в Visual Studio 2017 и более ранних версиях) автоматически создается в каталоге проекта для новых проектов. For example, the pch.cpp file ( stdafx.cpp in Visual Studio 2017 and earlier) is automatically created in the project directory for new 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
Вы установили пакет SDK или библиотеку стороннего производителя, но после установки пакета SDK или библиотеки не открывали новое окно командной строки разработчика. You have installed an SDK or third-party library, but you have not opened a new developer command prompt window after the SDK or library is installed. Если пакет SDK или библиотека добавляет файлы в путь поиска включаемых файлов, может потребоваться открыть новое окно командной строки разработчика, чтобы получить эти изменения переменных среды. If the SDK or library adds files to the INCLUDE path, you may need to open a new developer command prompt window to pick up these environment variable changes.
Файл использует управляемый код, но параметр компилятора /clr не указан. The file uses managed code, but the compiler option /clr is not specified. Дополнительные сведения см. в разделе /clr (компиляция среды CLR). For more information, see /clr (Common Language Runtime Compilation).
Файл компилируется с использованием другого параметра /analyze компилятора, чем используется для предварительной компиляции заголовков. The file is compiled by using a different /analyze compiler option setting than is used to precompile the headers. При предварительной компиляции заголовков для проекта все должны использовать одни и те же /analyze Параметры. When the headers for a project are precompiled, all should use the same /analyze settings. Дополнительные сведения см. в разделе /analyze (анализ кода). For more information, see /analyze (Code Analysis).
Файл или каталог был создан подсистемой Windows для Linux, учет регистра для каждого каталога включен, а указанный регистр пути или файла не совпадает с регистром пути или файла на диске. The file or directory was created by the Windows Subsystem for Linux, per-directory case sensitivity is enabled, and the specified case of a path or file does not match the case of the path or file on disk.
Файл, каталог или диск доступен только для чтения. The file, the directory, or the disk is read-only.
Visual Studio или средства командной строки не имеют достаточных разрешений для чтения файла или каталога. Visual Studio or the command line tools do not have sufficient permissions to read the file or the directory. Это может произойти, например, когда файлы проекта имеют разные права владения по сравнению с процессом Visual Studio или средствами командной строки. This can happen, for example, when the project files have different ownership than the process running Visual Studio or the command line tools. Иногда эту ошибку можно устранить, запустив Visual Studio или командную строку разработчика от имени администратора. Sometimes this issue can be fixed by running Visual Studio or the developer command prompt as Administrator.
Недостаточно дескрипторов файлов. 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.
Пример Example
В следующем примере создается ошибка C1083, если файл заголовка «test.h» не существует в исходном каталоге или в пути поиска include. The following example generates a C1083 error when the header file «test.h» does not exist in the source directory or on the include search path.
Сведения о том, как создавать проекты C/C++ в интегрированной среде разработки или в командной строке, а также сведения о настройке переменных среды см. в разделе проекты и сборки систем. For information about how to build C/C++ projects in the IDE or on the command line, and information about setting environment variables, see Projects and build systems.