Open kothru opened 1 year ago
デバッグ用のlaunch.json, ビルド用のtask.json登録しておくと便利
gitignoreに以下追加
Debug/
.vscode/
.vscode\launch.json
{
// IntelliSense を使用して利用可能な属性を学べます。
// 既存の属性の説明をホバーして表示します。
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) 起動",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/Debug/myproject.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"console": "externalTerminal"
},
]
}
.vscode\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": "MSBuild.exe",
"args": [
// Ask msbuild to generate full paths for file names.
"myproject.vcxproj",
"-p:Configuration=Debug",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
// "/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
// Reveal the output only if unrecognized errors occur.
"reveal": "silent"
},
// Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$msCompile"
}
]
}
BuildToolsのインストール https://visualstudio.microsoft.com/ja/downloads/?q=build+tools
以下参考にmyproject.vcxproj作成 https://learn.microsoft.com/ja-jp/cpp/build/walkthrough-using-msbuild-to-create-a-visual-cpp-project?view=msvc-170
PATHを通しておく C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin https://learn.microsoft.com/ja-jp/visualstudio/msbuild/whats-new-msbuild-16-0?view=vs-2022
MSBuild.exe myproject.vcxproj -p:Configuration=Debug