VSCodeとRunnerを使用したこちらの記事通りにやっただけ。
[Visual Studio Code][Mac] C言語をビルド(コンパイル)&ステップ実行する
プロの開発には物足りないかも。学習用には軽くて最適。
以下、追加のメモ書き。
シェルスクリプト
各言語でコンパイルと実行のコマンドが微妙に違う。
crun_gcc.sh
#!/bin/sh
if [ -z "$1" ]
then
echo "need argument"
exit
fi
#-------------------------------
# 一時的に使う実行ファイル名を作る
#-------------------------------
tempfile=`date '+%m%d%H%M%S'`
#-------------------------------
# コンパイル実行
#-------------------------------
gcc -o $tempfile $1
#-------------------------------
# 実行
#-------------------------------
./$tempfile
#-------------------------------
# 実行ファイル削除
#-------------------------------
rm $tempfile
csrun.sh
#!/bin/sh
if [ -z "$1" ]
then
echo "need argument"
exit
fi
#-------------------------------
# 一時的に使う実行ファイル名を作る
#-------------------------------
tempfile=`date '+%m%d%H%M%S'`
#-------------------------------
# コンパイル実行
#-------------------------------
mcs -out:$tempfile $1
#-------------------------------
# 実行
#-------------------------------
mono ./$tempfile
#-------------------------------
# 実行ファイル削除
#-------------------------------
rm $tempfile
cpprun.sh
#!/bin/sh
if [ -z "$1" ]
then
echo "need argument"
exit
fi
#-------------------------------
# 一時的に使う実行ファイル名を作る
#-------------------------------
tempfile=`date '+%m%d%H%M%S'`
#-------------------------------
# コンパイル実行
#-------------------------------
g++ -o $tempfile $1
#-------------------------------
# 実行
#-------------------------------
./$tempfile
#-------------------------------
# 実行ファイル削除
#-------------------------------
rm $tempfile
Permission denied
chmod +x xxx.sh
を一回叩いておけば、そのあとは通る。