基础设置
设置运行目录
1 2 3 4
| { "cwd": "${workspaceRoot}", "cwd": "${fileDirname}" }
|
设置参数
1
| args=["--do_train","--do_eval"]
|
设置环境变量
1 2
| "env":{ "PYTHONUNBUFFERED":"1", "CUDA_VISIBLE_DEVICES":"5"}
|
配置python调试单独文件
可实现类似pycharm中为每个文件定义单独的调试配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| { "name": "umtner-MT", "type": "python", "request": "launch", "program": "${file}", "cwd": "${workspaceFolder}/umtner", "console": "integratedTerminal", "justMyCode": true, "args": ["--do_train","--do_eval", # 设置参数 "--model_id=2", "--dataset_id=0", "--num_train_epochs=1"], # 设置环境变量 "env":{ "PYTHONUNBUFFERED":"1", "CUDA_VISIBLE_DEVICES":"5"} }
|
配置C++开发环境
Windows(g++)
参考1
参考2
Visual Studio Code 支持C++11
C++11编译选项
-std=c++11 -stdlib=libc++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| { "version": "0.2.0", "configurations": [ { "name": "C++ Launch (GDB)", // 配置名称,将会在启动配置的下拉菜单中显示 "type": "cppdbg", // 配置类型,这里只能为cppdbg "request": "launch", // 请求配置类型,可以为launch(启动)或attach(附加) "launchOptionType": "Local", // 调试器启动类型,这里只能为Local "targetArchitecture": "x86", // 生成目标架构,一般为x86或x64,可以为x86, arm, arm64, mips, x64, amd64, x86_64 "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", // 将要进行调试的程序的路径 "miDebuggerPath":"c:\\MinGW64\\bin\\gdb.exe", // miDebugger的路径,注意这里要与MinGw的路径对应 "args": [], // 程序调试时传递给程序的命令行参数,一般设为空即可 "stopAtEntry": false, // 设为true时程序将暂停在程序入口处,一般设置为false "cwd": "${workspaceRoot}", // 调试程序时的工作目录,一般为${workspaceRoot}即代码所在目录 "externalConsole": true, // 调试时是否显示控制台窗口,一般设置为true显示控制台 "preLaunchTask": "g++" // 调试会话开始前执行的任务,一般为编译程序,c++为g++, c为gcc } ] } tasks.json
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| { "version": "2.0.0", "tasks": [ { "type": "shell", "label": "g++", "command": "C:\\MinGW64\\bin\\g++.exe", "args": [ "-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "C:\\MinGW64\\bin" }, "problemMatcher": [ "$gcc" ], "group": "build" } ] }
|
MacOS(g++) 简洁
推荐
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| { "version": "2.0.0", "tasks": [ { "label": "g++ build", "type": "shell", "command": "g++", "args": [ "-o", "${fileDirname}/${fileBasenameNoExtension}", "${fileDirname}/${fileBasenameNoExtension}.cpp", "-g", "-std=c++11", "-stdlib=libc++", "-v" ], } ] }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| { "version": "2.0.0", "configurations": [ { "name": "g++ Launch", "type": "lldb", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "preLaunchTask": "g++ build", "targetArchitecture": "x64", "args": [], "cwd": "${workspaceRoot}", "environment": [], "externalConsole": false, "MIMode": "lldb" } ] }
|
MacOS(g++) 简洁 (bin)
推荐
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| { "version": "2.0.0", "tasks": [ { "label": "g++ build", "type": "shell", "command": "g++", "args": [ "-o", "${fileDirname}/bin/${fileBasenameNoExtension}", "${fileDirname}/${fileBasenameNoExtension}.cpp", "-g", "-std=c++11", "-stdlib=libc++", "-v" ], } ] }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| { "version": "2.0.0", "configurations": [ { "name": "g++ Launch", "type": "lldb", "request": "launch", "program": "${fileDirname}/bin/${fileBasenameNoExtension}", "preLaunchTask": "g++ build", "args": [], "cwd": "${workspaceRoot}", } ] }
|
MacOS(clang++)
参考
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| { "version": "2.0.0", "tasks": [ { "label": "clang++ build", "command": "clang++", "args": [ "-o", "${fileBasenameNoExtension}", "${fileBasenameNoExtension}.cpp", "-g", "-std=c++11", "-stdlib=libc++", "-v" ], "type": "shell", "presentation": { "echo": true, "reveal": "always", "panel": "shared" }, "problemMatcher": { "owner": "cpp", "fileLocation": [ "relative", "${workspaceRoot}" ], "pattern": { "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } } } ] }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| { "version": "2.0.0", "configurations": [ { "name": "C++ Launch", "type": "lldb", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "preLaunchTask": "clang++ build", "internalConsoleOptions": "openOnSessionStart", "logging": { "moduleLoad": false, "programOutput": true, "trace": false }, "showDisplayString": false, "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "environment": [], "externalConsole": false, "MIMode": "lldb" } ] }
|
不是必须的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| { "configurations": [ { "name": "Mac", "includePath": [ "${workspaceFolder}/**", "/Library/Developer/CommandLineTools/usr/include/c++/v1", "/usr/local/include", "/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include", "/Library/Developer/CommandLineTools/usr/include", "/usr/include" ], "defines": [], "macFrameworkPath": [ "/System/Library/Frameworks", "/Library/Frameworks" ], "compilerPath": "/usr/bin/clang", "cStandard": "c11", "cppStandard": "c++11", "intelliSenseMode": "macos-clang-x64" } ], "version": 4 }
|