c++ - 尝试在 MS Visual Studio 代码中安装 boost 1_70 C++ 但得到“不存在此类文件”
问题描述
我正在遵循这个程序。我正在使用带有代码运行器扩展的 minGW 编译器的 MS Visual Studio 代码。我想我已经成功构建了 b2 引擎。这是输出
boost-install.generate-cmake-config-version- C:\Program Files\boost\lib\cmake\boost_math_tr1l-1.70.0\boost_math_tr1l-config-version.cmake boost-install.generate-cmake-variant- C:\Program Files\boost\lib\cmake\boost_math_tr1l-1.70.0\libboost_math_tr1l-variant-mgw92-mt-d-x32-1_70-static.cmake boost-install.generate-cmake-config-
C:\Program Files\boost\lib\cmake\boost_math-1.70.0\boost_math-config.cmake boost-install.generate-cmake-config-version-
C:\Program Files\boost\lib\cmake\boost_math-1.70.0\boost_math-config-version.cmake ...
failed updating 678 targets... ...skipped 278 targets... ...updated 16845 targets...
任务.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: cpp.exe build active file",
"command": "C:\\MinGW\\bin\\cpp.exe",
"args": [
"-g",
"${file}",
"-o",
"-L",
"-1",
"-IC:\\Program Files\\boost\\include\\boost-1_70",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\\MinGW\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
和 c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:\\Program Files\\boost\\include\\boost-1_70"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\MinGW\\bin\\gcc.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x86"
}
],
"version": 4
}
以下是我尝试运行的代码:
#include <bits/stdc++.h>
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " ");
}
但得到以下错误:
PS C:\Users\dwiti\OneDrive\Documents\My Bluetooth> cd "c:\Users\dwiti\OneDrive\Documents\My Bluetooth\" ; if ($?) { g++ worthless.cpp -o worthless } ; if ($?) { .\worthless }
worthless.cpp:2:10: fatal error: boost/lambda/lambda.hpp: No such file or directory
2 | #include <boost/lambda/lambda.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
注意-我正在使用 MinGW g++ 编译器,并且也成功添加了受人尊敬的环境路径。而且我已经尝试了所有以前的答案解决方案,但由于某些我不明白的原因,它们对我不起作用。请帮我解决这个问题。谢谢!。
解决方案
推荐阅读
- laravel - 将flutter应用中的多张图片上传到laravel api
- node.js - 如何在 node.js 中创建对象数组
- docker - 定义的主机名无法访问 docker-compose 服务
- google-cloud-platform - gcloud 的 trace-token 选项用于什么?
- javascript - 导入 AOS 时出现“未捕获的语法错误:无法在模块外使用导入语句”
- python - Cygwin:(python)错误:密码学构建轮失败
- containers - RedHat CodeReady Container 命令:crc start -p .\pull-secret.txt 执行失败
- jsf - Jakarta EE 9 的 JSF 页面中“h”、“f”、...的命名空间是什么?
- css - 带有角材料卡的角多个柔性布局
- c++ - 编译器之间的嵌套模板类参数推导差异