0
votes

I know this is one of the most common questions here, but I couldn't make the already existing answers work for me.

I am trying the set my VS Code to work with C. So, as a proof of concept, I run this sophisticated code:

#include "io.h"

int main() {
    printf("Hello");
}

Obvious from the title, I receive this error message:

fatal error C1034: io.h: no include path set

Visually inspecting, io.h is in the folder: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\ which is included in the Path.

So, I looked for other solutions. A few of the answers suggested editing the settings.json. So, I added all the folders including all the header files to the settings.json. Note that all of these folders are also in the Path.

"C_Cpp_Runner.includePaths": [
    "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10240.0\\ucrt\\",
    "C:\\DEV\\vcpkg\\installed\\x86-windows\\include\\",
    "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\include\\"
  ],

For the sake of completeness, I also include my PATH variable here. enter image description here

Some answers mentioned checking the compiler as well. ```gcc --version`` output is as follows:

gcc (x86_64-posix-seh, Built by strawberryperl.com project) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I restarted my computer each time I edited Path. I don't know what else to do.

The questions on stackoverflow that I already tried to make work are: 1, 2, 3, 4 and a few more that I can't find now.

I apologise if there is an obvious solution that I miss, yet I already spent two days to solve this on my own.

Thanks

1

1 Answers

0
votes

You could try moving io.h into the path your code is. This error could be happening because the compiler couldn't find io.h under the current path.

If it doesn't work, you could try using Ctrl+Shift+P and search for Edit Configurations. Then go in C/C++: Edit Configurations(UI) and find Include Path and see if the path under is ${workspaceFolder}/**