#include errors detected in vscode

后端 未结 11 1009
名媛妹妹
名媛妹妹 2020-12-09 01:00

I am using Visual Studio Code in my C++ project. I installed Microsoft C/C++ Extension for VS Code. I got the following error:

#include error

相关标签:
11条回答
  • 2020-12-09 01:27
    • For Windows:

    1.Install Mingw-w64

    2.Then Edit environment variables for your account "C:\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin"

    3.Reload

    • For MAC

      1.Open search ,command + shift +P, and run this code “c/c++ edit configurations (ui)”

      2.open file c_cpp_properties.json and update the includePath from "${workspaceFolder}/**" to "${workspaceFolder}/inc"

    0 讨论(0)
  • 2020-12-09 01:34

    The error message "Please update your includePath" does not necessarily mean there is actually a problem with the includePath. The problem may be that VSCode is using the wrong compiler or wrong IntelliSense mode. I have written instructions in this answer on how to troubleshoot and align your VSCode C++ configuration with your compiler and project.

    0 讨论(0)
  • 2020-12-09 01:36

    After closing and reopening VS, this should resolve.

    0 讨论(0)
  • 2020-12-09 01:37

    The answer is here: How to use C/Cpp extension and add includepath to configurations.

    Click the light bulb and then edit the JSON file which is opened. Choose the right block corresponding to your platform (there are Mac, Linux, Win32 – ms-vscode.cpptools version: 3). Update paths in includePath (matters if you compile with VS Code) or browse.paths (matters if you navigate with VS Code) or both.

    Thanks to @Francesco Borzì, I will append his answer here:

    You have to Left

    0 讨论(0)
  • 2020-12-09 01:39

    If someone have this problem, maybe you just have to install build-essential.

    apt install build-essential
    
    0 讨论(0)
  • 2020-12-09 01:42

    I was trying a hello world program, and this line:

    #include <stdio.h>
    

    was underlined green. I tried:

    1. Deleting the line
    2. Re-writing the line
    3. Clicking the yellow bulb and choosing to update

    fixed the error warning. i don't know if it fixed the actual problem. But then i'm compiling via a linux VM on Windows 10

    0 讨论(0)
提交回复
热议问题