首页 > 解决方案 > 当头文件的文件夹位于同一目录中时检测到包含错误?

问题描述

目录看起来像这样

cpr
   include
      cpr
other code stuff
   the code I'm working on

我试过添加

${workspaceFolder}/**
${workspaceFolder}/cpr/include
${workspaceFolder}/cpr/**
${workspaceFolder}/cpr/

到includePath 无济于事。

代码:

using namespace std;

#include <iostream>
#include <cpr>

int main(int argc, char** argv) {
    auto r = cpr::Get(cpr::Url{"https://api.github.com/repos/whoshuu/cpr/contributors"},
                      cpr::Authentication{"user", "pass"},
                      cpr::Parameters{{"anon", "true"}, {"key", "value"}});
    r.status_code;                  // 200
    r.header["content-type"];       // application/json; charset=utf-8
    r.text;                         // JSON text string
}

预期:代码编译没有问题。

实际的:#include errors detected. Please update your includePath.

标签: c++visual-studio-code

解决方案


推荐阅读