Home > Enterprise >  cannot open source file stdio.h C in vscode
cannot open source file stdio.h C in vscode

Time:06-16

I've been trying to learn C recently. When I execute the following code in visual studio code:

#include <stdio.h>

int main()
{  
    // variable declaration
    int a, b, c;

    // user prompts
    printf("enter a number\n");
    scanf("%d", &a);
    printf("enter another number\n");
    scanf("%d", &b);
    // operation
    c = a   b;
    // printing
    printf("your number is %d", c);

    return 0;
}

it works fine. But I am given this error:

cannot open source file "stdio.h"

I have properly installed gcc, msys, etc. yet any and all #include header lines give the same error. Here is a image of the error (indent rainbow, material theme, C/C and error lens extensions): error image link

CodePudding user response:

By "It Works fine" I'm assuming that it compiles, If you have installed C/C Extensions Pack for VSCode it might need to configure the Include path

Please, take a look at configuration Example

  • Related