c++ - 如何在 VSCode 中使用 C++ 的 Boost?
问题描述
我正在学习 C++,我想尝试包含库,所以我从 Boost 开始,但我没有成功运行它。我在 Visual Studio Code 上运行 C++ 和 g++,使用C/C++ for VSCode由 Microsoft 编译并运行C/C++ 编译和运行 https://marketplace.visualstudio.com/items?itemName=danielpinto8zz6.c-cpp -编译-运行。这是我的代码和我的设置:
#include <boost/log/trivial.hpp>
int main()
{
BOOST_LOG_TRIVIAL(trace) << "A trace severity message !";
}
终端中的错误:
"C:\Program Files\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin\g++.exe" -g C:\Users\balth\Documents\Programmation\C++\testincludes.cpp -o C:\boost\include\boost-1_70\ C:\boost\lib C:\Users\balth\Documents\Programmation\C++\testincludes.exe
c_cpp_properties.json文件:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:\\boost\\include\\boost-1_70\\",
"C:\\boost\\lib\\"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/g++.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "${default}",
"compilerArgs": [],
"browse": {
"path": [
]
}
}
],
"version": 4
}
和task.json文件:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe générer le fichier actif",
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"C:\\boost\\include\\boost-1_70\\",
"C:\\boost\\lib",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Tâche générée par le débogueur."
},
{
"type": "cppbuild",
"label": "C/C++: g++.exe générer le fichier actif",
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"C:\\boost\\include\\boost-1_70\\",
"C:\\boost\\lib",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compilateur : \"C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe\""
},
{
"type": "cppbuild",
"label": "C/C++: cpp.exe générer le fichier actif",
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\cpp.exe",
"args": [
"-g",
"${file}",
"-o",
"C:\\boost\\include\\boost-1_70\\",
"C:\\boost\\lib",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compilateur : \"C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\cpp.exe\""
},
{
"type": "cppbuild",
"label": "C/C++: cpp.exe générer le fichier actif",
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\cpp.exe",
"args": [
"-g",
"${file}",
"-o",
"C:\\boost\\include\\boost-1_70\\",
"C:\\boost\\lib",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compilateur : \"C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\cpp.exe\""
}
],
"version": "2.0.0"
}
解决方案
推荐阅读
- reactjs - 将反应小部件嵌入到 Angular 4 站点时的 Polyfill 冲突
- python - 尝试使用 open(filename,'x') 打开文件时存在错误 - Windows 大小写区分大小写问题
- c# - 带有 MySql 和 Dot Net Core 的 IdentityServer4 - 在类型“System.Int16”和“System.Boolean”之间没有定义强制运算符
- c# - 更新现有 UWP 包会删除旧应用版本的应用数据
- visual-studio-code - VSCode 扩展在开发中有效,但在打包到 VSIX 后无效
- ionic-framework - 如何在 Ionic 中从 Windows 机器调试真正的 iOS 设备
- android - 矢量可绘制不覆盖
- sql - 如何将我的 Excel If 语句转换为 SQL 查询
- python - 如何在 Eclipse Che 中从 Python 打开新的浏览器选项卡?
- html - CSS奇怪的问题 - 当浏览器宽度改变时显示不同