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",
"type": "shell",
"command": "g++",
"args": [
"-g",
"${file}",
"-L",
"/usr/local/lib/lib*",
"-std=c++11",
"-lpthread", // 多线程
"-lGL", // opengl
"-lglut", // opengl
"-o",
"${fileBasenameNoExtension}",
]
// "args": ["-g", "${file}"]
// g++ first.cpp -o first `pkg-config --libs --cflags opencv` -ldl
// "args": ["-g", "${file}", "-std=c++11", "-o", "${fileBasenameNoExtension}.out"]
}
]
}
launch.json复制这里的进去就行了