廢話不多說,直接甩配置代碼。如有在參考過程中有問題請聯繫我。
首先,tasks.json是用來設置指令編譯代碼,launch.json是設置執行環境來執行代碼。setting是設置語言環境;
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", // task的名字是build,在launch.json內根據此任務名調用此任務;
"type": "shell", // 任務執行的是shell命令
"command": [ "vcvarsall.bat && gmake TARGET_PLATFORM=PC TARGET_BUILD=debug CORE=eve RUN_REF_FOR_STATS=1 all"], // 執行的具體指令
"args": [ // 如果上述的shell命令需要對象,則在這裏添加,不需要可直接刪掉;
"'-Wall'",
"'-std=c++17'", //使用c++17標準編譯
"'${file}'", //當前文件名
"-o", //對象名,不進行編譯優化
"'${fileBasenameNoExtension}.exe'", //當前文件名(去掉擴展名)
],
"problemMatcher": [
"$msCompile" //設置捕獲錯誤的工具;
]
}
]
}
launch.json:
備註1:編譯器的參數,可以用ctrl+space來查看有哪些可用參數,也可以在configurations中存在鼠標光標的情況下,點擊右下自動出現的Add Configurations按鈕。
備註2:應該選 launch不選attach,attach用來給正在執行的文件用的,比如網頁中的組件,而launch是執行新文件。
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch", // 執行當前文件
"program": "D:\\PROCESSOR_SDK_VISION_03_04_00_00\\ti_components\\algorithms\\REL.TIDLSRC.01.01.01.00\\modules\\ti_dl\\test\\out\\eve_test_dl_algo_debug_ref.out.exe",
//"program": "D:\\Aprj3_CNN_Test\\FromLamei190505\\tidl_model_import.out.exe",
"args": ["D:\\Aprj3_CNN_Test\\FromLamei190505\\tempDir\\configFilesList.txt"],
//"args": ["D:\\Aprj3_CNN_Test\\FromLamei190505\\tempDir\\mobilenetv1fc1.txt"],
"stopAtEntry": false, // 選爲true則會在打開控制檯後停滯,暫時不執行程序,一般選false.
"preLaunchTask": "build", //task的名字,一定要跟上述的task名字對應好;
"cwd": "D:\\Aprj3_CNN_Test\\FromLamei190505", //當前執行程序的路徑
"environment": [],
"externalConsole": true
}
]
}
setting.json:
{
"files.associations": {
"tidl_alg_int.h": "c",
"limits": "c"
}
}