简体   繁体   English

“无法在 VS 代码中打开源文件“vcruntime_string.h”(“string.h 的依赖项”)”

[英]"cannot open source file "vcruntime_string.h" (dependency of "string.h")" in VS Code

I am trying to learn C programming.我正在努力学习 C 编程。 And I am using VS Code for running almost everything.我正在使用 VS Code 来运行几乎所有的东西。 But none of my C Codes execute.但是我的 C 代码都没有执行。 The c_cpp_properties.json is configured with the MinGW header files library path included in the "msvc-x64" section. c_cpp_properties.json 配置了包含在“msvc-x64”部分中的 MinGW header 文件库路径。 It says "cannot open source file "vcruntime_string.h" (dependency of "string.h")" all the time.它一直显示“无法打开源文件“vcruntime_string.h”(“string.h 的依赖项”)”。

First of all, it's weird that it is not letting you compile by not finding string.h dependency.首先,奇怪的是它不让你通过找不到 string.h 依赖项来编译。 I suggest to try the following:我建议尝试以下操作:

  1. Try compiling your files either with gcc or g++ (depending on the language you're using) directly from the terminal, to see if you get the "a.out" file.尝试直接从终端使用 gcc 或 g++(取决于您使用的语言)编译您的文件,看看您是否获得“a.out”文件。

Ex: Open your terminal.例如:打开您的终端。 Find your.c files (if you're programming in C) gcc *.c then ./a.out找到你的 .c 文件(如果你用 C 编程) gcc *.c然后./a.out

  1. Try using CodeBlocks, Build and Run to see if you get the same error.尝试使用 CodeBlocks、Build and Run 来查看是否出现相同的错误。

If 1 or 2 worked, it means your VS software didn't like something when you made the installation process.如果 1 或 2 有效,则意味着您的 VS 软件在您进行安装过程时不喜欢某些东西。 Reinstall VS.重新安装VS。

I had the same problem.我有同样的问题。 I solved it just by reloading the window. You can either press Ctrl + R or type "Developer: Reload Window" in the command palette.我通过重新加载 window 解决了这个问题。您可以按 Ctrl + R 或在命令面板中键入“开发人员:重新加载窗口”。 You can open the command palette either by pressing Ctrl + Shift + P or going to "View"(up left corner) then "Command Palette..."您可以通过按 Ctrl + Shift + P 或转到“查看”(左上角)然后“命令调色板...”来打开命令调色板

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM