首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >#包括检测到的错误。请更新您的includePath。在使用C编写代码时,在vscode中禁用此转换单元的Squiggles。

问#包括检测到的错误。请更新您的includePath。在使用C编写代码时,在vscode中禁用此转换单元的Squiggles。
EN

Stack Overflow用户
提问于 2021-04-17 11:49:24
回答 1查看 12.5K关注 0票数 0
代码语言:javascript
复制
[#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit][1] (C:\Users\kw27w\OneDrive\Desktop\test\test.c).C/C++(1696)
cannot open source file "stdbool.h"C/C++(1696)

这就是发生的错误,在下有一条红线,当我点击它时有一个灯泡,edit "includepath" settings说,当我点击它时,它移动到"c_cpp_properties.json“。

如何以及在何处在下面的配置中添加包含路径?

代码语言:javascript
复制
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:\\Users\\kw27w\\.vscode\\extensions\\ms-vscode.cpptools-1.3.0"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

我的代码是

代码语言:javascript
复制
#include <stdbool.h>
#include <math.h>

/*
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first few prime numbers are {2, 3, 5, 7, 11, ….}

The idea to solve this problem is to iterate through all the numbers starting from 2 to sqrt(N) using a for loop and for every number check if it divides N. If we find any number that divides, we return false. If we did not find any number between 2 and sqrt(N) which divides N then it means that N is prime and we will return True. 
Why did we choose sqrt(N)? 
The reason is that the smallest and greater than one factor of a number cannot be more than the sqrt of N. And we stop as soon as we find a factor. For example, if N is 49, the smallest factor is 7. For 15, smallest factor is 3.
*/

bool is_prime(int n){
  int i, flag = 1;
    // Iterate from 2 to sqrt(n)
    for (i = 2; i <= sqrt(n); i++) {
 
        // If n is divisible by any number between
        // 2 and n/2, it is not prime
        if (n % i == 0) {
            flag = 0;
            break;
        }
    }
 
    if (n <= 1)
        flag = 0;
 
    if (flag == 1) {
        return true;
    }
    else {
        return false;
    }
}

​

​

EN

回答 1

Stack Overflow用户

发布于 2021-05-12 00:21:02

我猜你在麦克身上?我只是碰到了同样的问题。

你安装了自制的吗?如果不是,那就是你的问题了。macOS缺少了Windows在HomeBrew主页上通常拥有的很多东西,"Homebrew,macOS(或Linux)缺少的软件包管理器“。因此,我们需要将缺失的所有内容下载到Mac上,而HomeBrew就是解决方案:https://brew.sh <<下载就在这里。

如果由于某些原因不能安装HomeBrew,那么Microsoft在这里有一个解决方案:https://vcpkg.io/en/getting-started.html

告诉我是怎么回事。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67137818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档