Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
885 views
in Technique[技术] by (71.8m points)

c - How to properly add an includePath in c_cpp_properties.json in vscode

I'm trying to develop a C program in webassembly, and need to include the emscripten header files for that purpose.

The following C code:

#include <stdio.h>
#include <emscripten/emscripten.h>
...

Results in the following error:

#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/home/christianskovholm/Documents/Source/wasm_3/hello3.c).

In my c_cpp_properties.json for the project of the above C code, i have the following configuration. As you can see, I have added the directory where emscripten/emscripten.h lives. So why am I getting the include error?

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "linux-gcc-x64"
        },
        {
            "name": "default",
            "includePath": [
                "${workspaceFolder}/**",
                "/home/christianskovholm/Documents/Source/emsdk/upstream/emscripten/system/include/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}
question from:https://stackoverflow.com/questions/65914927/how-to-properly-add-an-includepath-in-c-cpp-properties-json-in-vscode

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...