Vscode-code-runner: تكوين أداة البرمجة لـ C ++ Build Tools (MSVC)

تم إنشاؤها على ١٣ يوليو ٢٠١٨  ·  5تعليقات  ·  مصدر: formulahendry/vscode-code-runner

بشكل افتراضي ، يتم تكوين عداء التعليمات البرمجية لـ mingw (g ++).

_كيف يمكنني تكوينه لـ C ++ Build Tools (MSVC أو cl.exe) ._

fyi question

التعليق الأكثر فائدة

ها هي محتويات settings.json التي عملت معي

"{
"files.autoSave": "afterDelay"،
"code-runner.runInTerminal": صحيح ،

"code-runner.executorMap": {
    "python": "$pythonPath -u $fullFileName",
    "cpp": " \"C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/Common7/Tools/VsDevCmd.bat\" && cd $dir && cl $fileName /fe$fileNameWithoutExt.exe && $dir$fileNameWithoutExt.exe ",
}

} `

ال 5 كومينتر

"cpp": "\" MyFolder \ VC \ bin \ amd64 \ vcvars64.bat \ "&& cd $ dir && cl $ fileName /fe$fileNameWithoutExt.exe && $ dir $ fileNameWithoutExt.exe" ،

شكرا

ها هي محتويات settings.json التي عملت معي

"{
"files.autoSave": "afterDelay"،
"code-runner.runInTerminal": صحيح ،

"code-runner.executorMap": {
    "python": "$pythonPath -u $fullFileName",
    "cpp": " \"C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/Common7/Tools/VsDevCmd.bat\" && cd $dir && cl $fileName /fe$fileNameWithoutExt.exe && $dir$fileNameWithoutExt.exe ",
}

} `

أدناه هو الإعداد الخاص بي مع "/ Zi / EHsc / Fe:" args التي رأيتها من المستند الرسمي لـ VSCode على إعداد VC ++. قد يختلف مسار ملف VsDevCmd.bat تبعًا لإصدار VS.
"code-runner.executorMap": { "cpp": " \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/VsDevCmd.bat\" && cd $dir && cl $fileName /Zi /EHsc /Fe:$fileNameWithoutExt.exe && $dir$fileNameWithoutExt.exe ", }

هذا عمل واحد بالنسبة لي عند تعيين Default Shell على PowerShell . لا يعمل مع موجه الأوامر (cmd.exe) (ملف VsDevCmd.bat مخصص لـ cmd.exe ). لقد قمت بتعيينه للغة C ("c") ولكن من المحتمل أن يعمل مع C ++ ("cpp"):

"code-runner.executorMap": {
"c": "Import-Module \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell 00595aab; cd $dir; cl $fileName && del $fileNameWithoutExt.obj && Clear-Host && Start-Process pwsh -ArgumentList \"-Command  &{.\\$fileNameWithoutExt; pause}\"",

سطر الأوامر لـ PowerShell:
Import-Module \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/Tools/Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell 00595aab
تم استخراجه من Developer PowerShell لـ VS 2019 Windows اختصار قائمة ابدأ ضمن خصائصه -> الهدف . ضع في اعتبارك أن كل Enter-VsDevShell له رقم معرف فريد خاص به. يجب عليك استخدام واحد خاص بك.

سطر الأوامر لـ cmd.exe:
\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/Tools/VsDevCmd.bat\"
تم استخراجه من موجه أوامر المطور لاختصار قائمة ابدأ في

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات