LoginSignup
2
4

More than 5 years have passed since last update.

【VSCode】MacでC/C#/C++の開発をする

Last updated at Posted at 2018-04-16

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 を一回叩いておけば、そのあとは通る。

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4