[#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“。
如何以及在何处在下面的配置中添加包含路径?
{
"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
}我的代码是
#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;
}
}

发布于 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
告诉我是怎么回事。
https://stackoverflow.com/questions/67137818
复制相似问题