我試圖將不同的優化級別(-O0、-O1、-O2、-O3等)應用于一個.cpp檔案的編譯和執行。
但是,我無法弄清楚我需要使用的確切語法以及在哪里寫指令(即在哪個終端,VSCode終端還是MinGW終端)?
請提供任何幫助。
tasks.json:
{
"tasks": [
{
"type": "cppbuild",
"標簽": "C/C : g .exe build active file"。
"命令": "C:msys64mingw64bing .exe"/span>。
"args": [
"-g",
"${file}"。
"-o",
"${fileDirname}${fileBasenameNoExtension}.exe"。
],
"options": {
"cwd": "${fileDirname}"。
},
"problemMatcher": [
"$gcc"/span>
],
"group": {
"kind": "build",
"isDefault": true。
},
"detail": "由除錯器生成的任務"。
},
{
"type": "cppbuild"。
"標簽": "C/C : cpp.exe build active file"。
"命令": "C:msys64mingw64bincpp.exe"/span>。
"args": [
"-g",
"${file}"。
"-o",
"${fileDirname}${fileBasenameNoExtension}.exe"。
],
"options": {
"cwd": "${fileDirname}"。
},
"problemMatcher": [
"$gcc"/span>
],
"group": "build",
"細節": "編譯器。C:msys64mingw64bincpp.exe"
}
],
"version": "2.0.0"。
uj5u.com熱心網友回復:
在這個領域:
"args": [
"-g",
"${file}"/span>。
"-o"。
"${fileDirname}${fileBasenameNoExtension}.exe"/span>。
],
添加優化選項:
"args": [
"-g",
"${file}"/span>。
"-o"。
"${fileDirname}${fileBasenameNoExtension}.exe"/span>。
"-O2"。
],
考慮到你有兩個任務(我不確定你為什么有第二個任務),你需要在正確的任務中設定它。如果我是你,我會洗掉那個未使用的任務,而是為除錯和發布構建創建一個任務。Visual Studio Code中的發布構建
請注意,這是關于c#的,不能復制粘貼!
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/333275.html
標籤:
上一篇:強制要求用IE瀏覽器打開啟動器
