Visual Studio Code内でC++14で書かれたコードの実行をしたい
https://strtbox.hatenablog.com/entry/2018/09/25/062615
↑の記事を参考にしながらVisual Studio CodeでC++14を実行するための環境を作ろうとしているのですが、当記事の
「main.cppに適当なコード書いてCtrl+shift+Bで下のように実行できればひとまず完成です。」
のところで、ターミナルに以下のように表示されたものの、エラーも吐かず、実行結果も出ずで困っています。
元記事ではbatファイルの中身に
call a.exe
と書かれており、記事内での実行したときの画像にはa.exeが含まれていて、
僕がCtrl+Shift+Bで実行しようとしてもa.exeは作られず、エクスプローラーで.vscodeを開いてもa.exeが存在しませんでした。
Ctrl+Shift+Bでターミナルに表示された内容
> Executing task: ./build.bat < ターミナルの処理が終了しました (終了コード: 1) ターミナルはタスクで再利用されます、閉じるには任意のキーを押してください。
実行しようとしたソースコード
C++14
1#include <bits/stdc++.h> 2 3using namespace std; 4 5int main(){ 6 int a = 5; 7 cout << a << endl; 8 return 0; 9}
試したこと
a.exeがセキュリティソフト(Norton)によって生成を妨害されていないかを確認しましたが、セキュリティソフトのスキャンリストにはa.exeは含まれていませんでした。
補足情報
c_cpp_properties.jsonとtask.jsonとbuild.batです。
json
1 2{ 3 4 "configurations": [ 5 6 { 7 8 "name": "Win32", 9 10 "includePath": [ 11 12 "C:/MinGW/lib/gcc/mingw32/6.3.0/include" 13 14 ], 15 16 "defines": [ 17 18 "_DEBUG", 19 20 "UNICODE", 21 22 "_UNICODE" 23 24 ], 25 26 "windowsSdkVersion": "10.0.16299.0", 27 28 "compilerPath": "C:/MinGW/bin/g++.exe", 29 30 "cStandard": "c11", 31 32 "cppStandard": "c++14", 33 34 "intelliSenseMode": "gcc-x64" 35 36 } 37 38 ], 39 40 "version": 4 41 42 }
bat
1g++ -std=gnu++1y -O2 main.cpp 2 3call a.exe 4
task
1{ 2 // See https://go.microsoft.com/fwlink/?LinkId=733558 3 // for the documentation about the tasks.json format 4 "version": "2.0.0", 5 "tasks": [ 6 { 7 "label": "echo", 8 "type": "shell", 9 "command": "./build.bat", 10 "group": { 11 "kind": "build", 12 "isDefault": true 13 } 14 } 15 ] 16}
あなたの回答
tips
プレビュー