C1803错误

本文详细介绍了编译器C1083错误的常见原因,包括文件名输入错误、文件未包含在编译器搜索路径中、使用了错误版本的文件名、预编译头未预编译等,并提供了相应的解决方法。

错误 C1083

Visual Studio 2013
3(共 5)对本文的评价是有帮助 评价此主题
无法打开 filetype 文件:“file”: message

编译器在找不到文件时会生成 C1083 错误。 下面是编译器生成此错误的常见原因。

指定的文件名错误

文件名可能键入有误。 例如,

C++
#include <algorithms.h>

可能找不到你想要的文件。 有一个名为 algorithms 的标准 C++ 库头文件,它没有 .h 文件扩展名。 通过此 include 指令找不到该文件。 若要修复此问题,请验证输入的文件名是否正确。

某些 C 运行库标头位于标准包含目录的子目录中。 例如,若要包含 sys\types.h,则必须将 sys 子目录名称包含在包含指令中的:

#include <sys\types.h>

文件未包含在编译器搜索路径中

此编译器无法使用 include 或 import 指令指示的搜索规则找到该文件。 例如,使用引号括起的头文件名

#include "myincludefile.h"

告知编译器先在包含源文件的相同目录中查找该文件,然后在生成环境指定的其他位置查找。 如果引号包含绝对路径,则编译器仅在该位置查找文件。 如果引号包含相对路径,则编译器在相对于源目录的目录中查找文件。 如果名称使用尖括号括起,

#include <stdio.h>

编译器遵循生成环境、/I 编译器选项、/X 编译器选项和 INCLUDE 环境变量定义的搜索路径。 有关详细信息(包括有关用于查找文件的搜索顺序的特定详细信息),请参阅 #include 指令 (C/C++)和 #import 指令 (C++)

即使头文件作为项目的一部分列在“解决方案资源管理器”中,也只有在文件由 include 或 import 指令引用并且位于目录搜索路径中时,编译器才能找到这些文件。 不同种类的生成可能会使用不同搜索路径。 /X 编译器选项可用于从包含文件搜索路径中排除目录。 这样不同的生成就可以使用具有相同名称、但保存在不同目录中的不同包含文件。 这是使用预处理器命令进行的条件编译的替代方法。 有关 /X 编译器选项的更多信息,请参见 /X(忽略标准包含路径)

在命令行中调用编译器时,通常会使用环境变量来指定搜索路径。 如果通过 INCLUDE 环境变量描述的搜索路径设置不正确,则会生成 C1083 错误。 有关如何使用环境变量的更多信息,请参见如何:在生成中使用环境变量

若要修复此问题,请更改编译器用于搜索包含或导入的文件的路径。 新项目使用默认搜索路径。 您可能必须修改路径才能为项目添加目录。 如果在命令行上进行编译,则设置 INCLUDE 环境变量或 /I 编译器选项以指定文件的路径。 若要在 Visual Studio 中设置包含目录路径,请打开项目的“属性页”对话框,展开“配置属性”“VC++ 目录”,然后编辑“包含目录”值。 有关由 Visual Studio 中的编译器搜索的每个用户和每个项目的目录的详细信息,请参阅 “VC++ 目录”属性页 有关 /I 编译器选项的更多信息,请参见 /I(附加包含目录)

包含了错误版本的文件名

C1083 错误还可能指示包含了错误版本的文件。 例如,某个生成可能包含错误版本的文件,该文件的 include 指令针对不是用于该生成的头文件。 当找不到头文件时,编译器会生成 C1083 错误。 此问题的解决方法是使用正确的文件,而不是向生成添加头文件或目录。

预编译头尚未预编译

当项目配置为使用预编译头时,必须创建相关 .pch 文件,以便可以编译使用头内容的文件。 例如,会在项目目录中为新 MFC 项目自动创建 stdafx.cpp 文件。 先编译该文件以创建预编译的头文件。(在典型生成过程设计中,这是自动完成的。)有关详细信息,请参阅创建预编译的头文件

其他原因

  • 文件使用托管代码,但是未指定编译器选项 /clr 有关更多信息,请参见 /clr(公共语言运行时编译)

  • 将使用不同于预编译头时使用的 /analyze 编译器选项设置对文件进行编译。(预编译项目的头时,全都应使用相同的 /analyze 设置。)有关更多信息,请参见 /analyze(代码分析)

  • 文件、目录或磁盘为只读。

  • 未授予文件或目录的访问权限。

  • 文件句柄不足。 关闭一些应用程序,然后重新编译。 这种情况一般不常见。 但是,在物理内存有限的计算机上生成大型项目时,可能会发生这种情况。

下面的示例生成 C1083 错误。

// C1083.cpp
// compile with: /c
#include "test.h"   // C1083 test.h does not exist
#include "stdio.h"   // OK

有关如何在 IDE 或命令行中生成 C/C++ 项目的信息,以及有关设置环境变量的信息,请参见Building C/C++ Programs

PS C:\Users\admin> cd D:\download\RedDino-main PS D:\download\RedDino-main> pip install -r requirements.txt Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://download.pytorch.org/whl/cu117, https://pypi.nvidia.com Requirement already satisfied: torch>=2.6.0 in c:\users\admin\anaconda3\lib\site-packages (from -r requirements.txt (line 2)) (2.9.1) Collecting torchvision>=0.21.0 (from -r requirements.txt (line 3)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5c/ec/54a96ae9ab6a0dd66d4bba27771f892e36478a9c3489fa56e51c70abcc4d/torchvision-0.24.1-cp313-cp313-win_amd64.whl (4.3 MB) Collecting omegaconf (from -r requirements.txt (line 4)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e3/94/1843518e420fa3ed6919835845df698c7e27e183cb997394e4a670973a65/omegaconf-2.3.0-py3-none-any.whl (79 kB) Collecting torchmetrics==0.10.3 (from -r requirements.txt (line 5)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/08/b7/f1e49be0e076c8ec981f1d4cea1f32da2bd754eaeaf6ed74d5add3f840b4/torchmetrics-0.10.3-py3-none-any.whl (529 kB) Collecting fvcore (from -r requirements.txt (line 6)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a5/93/d056a9c4efc6c79ba7b5159cc66bb436db93d2cc46dca18ed65c59cc8e4e/fvcore-0.1.5.post20221221.tar.gz (50 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting iopath (from -r requirements.txt (line 7)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/72/73/b3d451dfc523756cf177d3ebb0af76dc7751b341c60e2a21871be400ae29/iopath-0.1.10.tar.gz (42 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting xformers>=0.0.22 (from -r requirements.txt (line 8)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a9/ef/4f59589fe37e206f5bb6158aa1294cfa0e79d52bca99ea0fd3f5c8a73404/xformers-0.0.33.post1-cp39-abi3-win_amd64.whl (105.1 MB) Collecting submitit (from -r requirements.txt (line 9)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/db/80/90e0a0f4008f6572de58b042b1db9daced15d348a3586dda5efc9faba65e/submitit-1.5.3-py3-none-any.whl (75 kB) Requirement already satisfied: numpy>=1.17.2 in c:\users\admin\anaconda3\lib\site-packages (from torchmetrics==0.10.3->-r requirements.txt (line 5)) (2.1.3) Requirement already satisfied: packaging in c:\users\admin\anaconda3\lib\site-packages (from torchmetrics==0.10.3->-r requirements.txt (line 5)) (24.2) Requirement already satisfied: filelock in c:\users\admin\anaconda3\lib\site-packages (from torch>=2.6.0->-r requirements.txt (line 2)) (3.17.0) Requirement already satisfied: typing-extensions>=4.10.0 in c:\users\admin\anaconda3\lib\site-packages (from torch>=2.6.0->-r requirements.txt (line 2)) (4.12.2) Requirement already satisfied: sympy>=1.13.3 in c:\users\admin\anaconda3\lib\site-packages (from torch>=2.6.0->-r requirements.txt (line 2)) (1.13.3) Requirement already satisfied: networkx>=2.5.1 in c:\users\admin\anaconda3\lib\site-packages (from torch>=2.6.0->-r requirements.txt (line 2)) (3.4.2) Requirement already satisfied: jinja2 in c:\users\admin\anaconda3\lib\site-packages (from torch>=2.6.0->-r requirements.txt (line 2)) (3.1.6) Requirement already satisfied: fsspec>=0.8.5 in c:\users\admin\anaconda3\lib\site-packages (from torch>=2.6.0->-r requirements.txt (line 2)) (2025.3.2) Requirement already satisfied: setuptools in c:\users\admin\anaconda3\lib\site-packages (from torch>=2.6.0->-r requirements.txt (line 2)) (72.1.0) Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users\admin\anaconda3\lib\site-packages (from torchvision>=0.21.0->-r requirements.txt (line 3)) (11.1.0) Collecting antlr4-python3-runtime==4.9.* (from omegaconf->-r requirements.txt (line 4)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/3e/38/7859ff46355f76f8d19459005ca000b6e7012f2f1ca597746cbcd1fbfe5e/antlr4-python3-runtime-4.9.3.tar.gz (117 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: PyYAML>=5.1.0 in c:\users\admin\anaconda3\lib\site-packages (from omegaconf->-r requirements.txt (line 4)) (6.0.2) Collecting yacs>=0.1.6 (from fvcore->-r requirements.txt (line 6)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/38/4f/fe9a4d472aa867878ce3bb7efb16654c5d63672b86dc0e6e953a67018433/yacs-0.1.8-py3-none-any.whl (14 kB) Requirement already satisfied: tqdm in c:\users\admin\anaconda3\lib\site-packages (from fvcore->-r requirements.txt (line 6)) (4.67.1) Collecting termcolor>=1.1 (from fvcore->-r requirements.txt (line 6)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f9/d5/141f53d7c1eb2a80e6d3e9a390228c3222c27705cbe7f048d3623053f3ca/termcolor-3.2.0-py3-none-any.whl (7.7 kB) Requirement already satisfied: tabulate in c:\users\admin\anaconda3\lib\site-packages (from fvcore->-r requirements.txt (line 6)) (0.9.0) Collecting portalocker (from iopath->-r requirements.txt (line 7)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/4b/a6/38c8e2f318bf67d338f4d629e93b0b4b9af331f455f0390ea8ce4a099b26/portalocker-3.2.0-py3-none-any.whl (22 kB) INFO: pip is looking at multiple versions of xformers to determine which version is compatible with other requirements. This could take a while. Collecting xformers>=0.0.22 (from -r requirements.txt (line 8)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d4/4d/40daad1068fb19291598bb656d7441c157bd04803c3534df05641889730e/xformers-0.0.33-cp39-abi3-win_amd64.whl (8.3 MB) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/50/19/ea64609a535f87a44cb177dc37c6d6a58f6d540adfff819d565fb0657cf7/xformers-0.0.32.post2-cp39-abi3-win_amd64.whl (100.2 MB) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/91/70/7dee5a786d77a63cf20dac60c38086bd2202d59ae89c8acef0ef6331c374/xformers-0.0.32.post1-cp39-abi3-win_amd64.whl (100.2 MB) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ff/ba/e953b24cc6e1ac3798d8ac16565b0c63c050df3b8130df752e70e1ce98ed/xformers-0.0.31.post1-cp39-abi3-win_amd64.whl (100.2 MB) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b5/66/7b60ec52da94a0da3383ba385b43e42cee8854c001b5cb6cf98a909665c8/xformers-0.0.31-cp39-abi3-win_amd64.whl (100.2 MB) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/bf/f7/dd2269cce89fd1221947dd7cc3a60707ffe721ef55c1803ac3b1a1f7ae5c/xformers-0.0.30.tar.gz (10.2 MB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [23 lines of output] Traceback (most recent call last): File "C:\Users\admin\anaconda3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module> main() ~~~~^^ File "C:\Users\admin\anaconda3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) ~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\admin\anaconda3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel return hook(config_settings) File "C:\Users\admin\AppData\Local\Temp\pip-build-env-qegqy3qh\overlay\Lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\admin\AppData\Local\Temp\pip-build-env-qegqy3qh\overlay\Lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires self.run_setup() ~~~~~~~~~~~~~~^^ File "C:\Users\admin\AppData\Local\Temp\pip-build-env-qegqy3qh\overlay\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\admin\AppData\Local\Temp\pip-build-env-qegqy3qh\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup exec(code, locals()) ~~~~^^^^^^^^^^^^^^^^ File "<string>", line 24, in <module> ModuleNotFoundError: No module named 'torch' [end of output] note: This error originates from a subprocess, and is likely not a problem wi
最新发布
11-26
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值