launch.json
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) 启动", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/pro", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true }, ], "preLaunchTask": "build", "miDebuggerPath": "/usr/bin/gdb" } ] }View Code
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": "make pro", "options": { "cwd": "${workspaceFolder}" } } ] }View Code
makefile
src_directory := src obj_directory := obj srcs := $(shell find $(src_directory) -name "*.cpp") objs := $(patsubst %.cpp,%.o,$(srcs)) objs := $(subst $(src_directory),$(obj_directory),$(objs)) .PHONY: debug run debug: @echo $(objs) pro: ${objs} @g++ $^ -o $@ run:pro @./pro $(obj_directory)/%.o : $(src_directory)/%.cpp @g++ -g -c $< -o $@ # $< 第一个生产项 # $^ 所有的生成项 # $@ 第一个生产项View Code
标签:src,objs,%.,vscode,pro,makefile,C++,gdb,directory From: https://www.cnblogs.com/xiaoruirui/p/16825549.html