尝试用 C++ 制作一个不和谐的机器人,尝试添加库 D++ 并得到一个波浪线。
我创建了一个文件夹,将库放入其中,并将其添加到 includePath,但是当我放入代码 #include 时,我收到一个奇怪的错误,内容如下:
cannot open source file "variant" (dependency of "dpp.h")
检查了其他解决方案,但到目前为止没有任何效果,我的代码:
#include <iostream>
#include <dpp.h> //Error here
int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}
我的c-cpp-properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/libraries/libdpp-10.0.23-win64/include/dpp-10.0/dpp",
"C:/MinGW/bin/"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/MinGW/bin/g++.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-gcc-x64"
}
],
"version": 4
}
文档上有一个 指南)或 Visual C++。您还可以下载该库并按照另一个指南手动安装。但使用该库的最简单方法是使用 VS2022 template。