【发布时间】:2020-11-30 08:06:06
【问题描述】:
我在 Ubuntu 20.04 上使用 Vscode。
我正在尝试编译这里的文件
我在终端输入这个
g++ main.cpp examplewindow.cpp -o WindowBox11 -v -std=c++0x `pkg-config gtkmm-3.0 --cflags --libs`
它编译得很好。
但不适用于 Vscode。
这是我的 c_cpp_properties.json 文件
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/gtkmm-3.0",
"/usr/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "gnu18",
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-x64",
"compilerArgs": [
"-std=c++0x",
"`pkg-config gtkmm-3.0 --cflags --libs`",
"-v"
]
}
],
"version": 4
}
和tasks.json文件
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build & run", //It's name of the task , you can have several tasks
"type": "shell", //type can be either 'shell' or 'process' , more details will be given below
"command": "g++",
"args": [
"-g", //gnu debugging flag , only necessary if you want to perform debugging on file
"${file}", //${file} gives full path of the file
"-o",
"${workspaceFolder}\\build\\${fileBasenameNoExtension}", //output file name
"&&", //to join building and running of the file
"${workspaceFolder}\\build\\${fileBasenameNoExtension}",
],
"group": {
"kind": "build", //defines to which group the task belongs
"isDefault": true
},
"presentation": { //Explained in detail below
"echo": false,
"reveal": "always",
"focus": true,
"panel": "shared",
"clear": false,
"showReuseMessage": false
},
"problemMatcher": "$gcc"
},
]
}
有什么想法吗?
【问题讨论】:
标签: c++ ubuntu visual-studio-code include-path