Debian 11.2にgccをインストールする

環境
# cat /etc/debian_version
11.2

インストールの方法
1.開発パッケージをインストール します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo apt install build-essential
# sudo apt install build-essential
# sudo apt install build-essential

2.gccのバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# gcc --version gcc (Debian 10.2.1-6) 10.2.1 20210110 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

3.動作確認
# vi test.c
下記の通りに編集します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#include <stdio.h>
int main()
{
printf("Hello World,study c language");
return 0;
}
#include <stdio.h> int main() { printf("Hello World,study c language"); return 0; }
#include <stdio.h>
int main()
{
printf("Hello World,study c language");
return 0;
}

ファイルをコンパイルします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# gcc -o test test.c
# gcc -o test test.c
# gcc -o test test.c

コンパイルしたファイルを実行します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ./test
Hello World,study c language
# ./test Hello World,study c language
# ./test
Hello World,study c language

 

Debian 11

Posted by arkgame