dev@dev-desktop:~/hello$ gcc -dumpversion
Command 'gcc' not found, but can be installed with:
sudo apt install gcc
dev@dev-desktop:~/hello$ sudo apt-get install build-essential -y
[sudo] dev의 암호:
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
다음 패키지가 자동으로 설치되었지만 더 이상 필요하지 않습니다:
libllvm7
Use 'sudo apt autoremove' to remove it.
다음의 추가 패키지가 설치될 것입니다 :
dpkg-dev fakeroot g++ g++-7 gcc gcc-7 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libc-dev-bin libc6-dev libcilkrts5
libdpkg-perl libfakeroot libgcc-7-dev libitm1 liblsan0 libmpx2 libquadmath0 libstdc++-7-dev libtsan0 libubsan0 linux-libc-dev make manpages-dev
제안하는 패키지:
debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib autoconf automake libtool flex bison gcc-doc gcc-7-multilib gcc-7-locales libgcc1-dbg
libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc bzr libstdc++-7-doc
make-doc
다음 새 패키지를 설치할 것입니다:
build-essential dpkg-dev fakeroot g++ g++-7 gcc gcc-7 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libc-dev-bin libc6-dev
libcilkrts5 libfakeroot libgcc-7-dev libitm1 liblsan0 libmpx2 libquadmath0 libstdc++-7-dev libtsan0 libubsan0 linux-libc-dev make manpages-dev
다음 패키지를 업그레이드할 것입니다:
libdpkg-perl
1개 업그레이드, 27개 새로 설치, 0개 제거 및 34개 업그레이드 안 함.
27.2 M바이트 아카이브를 받아야 합니다.
이 작업 후 117 M바이트의 디스크 공간을 더 사용하게 됩니다.
받기:1 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 libc-dev-bin amd64 2.27-3ubuntu1 [71.8 kB]
받기:2 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-libc-dev amd64 4.15.0-65.74 [1,130 kB]
받기:3 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 libc6-dev amd64 2.27-3ubuntu1 [2,587 kB]
받기:4 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libitm1 amd64 8.3.0-6ubuntu1~18.04.1 [28.0 kB]
받기:5 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libatomic1 amd64 8.3.0-6ubuntu1~18.04.1 [9,184 B]
받기:6 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libasan4 amd64 7.4.0-1ubuntu1~18.04.1 [359 kB]
받기:7 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 liblsan0 amd64 8.3.0-6ubuntu1~18.04.1 [133 kB]
받기:8 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libtsan0 amd64 8.3.0-6ubuntu1~18.04.1 [288 kB]
받기:9 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libubsan0 amd64 7.4.0-1ubuntu1~18.04.1 [126 kB]
받기:10 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcilkrts5 amd64 7.4.0-1ubuntu1~18.04.1 [42.5 kB]
받기:11 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmpx2 amd64 8.3.0-6ubuntu1~18.04.1 [11.6 kB]
받기:12 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libquadmath0 amd64 8.3.0-6ubuntu1~18.04.1 [133 kB]
받기:13 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgcc-7-dev amd64 7.4.0-1ubuntu1~18.04.1 [2,381 kB]
받기:14 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 gcc-7 amd64 7.4.0-1ubuntu1~18.04.1 [7,463 kB]
받기:15 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 gcc amd64 4:7.4.0-1ubuntu2.3 [5,184 B]
받기:16 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libstdc++-7-dev amd64 7.4.0-1ubuntu1~18.04.1 [1,468 kB]
받기:17 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 g++-7 amd64 7.4.0-1ubuntu1~18.04.1 [7,574 kB]
받기:18 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 g++ amd64 4:7.4.0-1ubuntu2.3 [1,568 B]
받기:19 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 make amd64 4.1-9.1ubuntu1 [154 kB]
받기:20 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdpkg-perl all 1.19.0.5ubuntu2.3 [211 kB]
받기:21 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 dpkg-dev all 1.19.0.5ubuntu2.3 [607 kB]
받기:22 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 build-essential amd64 12.4ubuntu1 [4,758 B]
받기:23 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 libfakeroot amd64 1.22-2ubuntu1 [25.9 kB]
받기:24 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 fakeroot amd64 1.22-2ubuntu1 [62.3 kB]
받기:25 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 libalgorithm-diff-perl all 1.19.03-1 [47.6 kB]
받기:26 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 libalgorithm-diff-xs-perl amd64 0.04-5 [11.1 kB]
받기:27 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 libalgorithm-merge-perl all 0.08-3 [12.0 kB]
받기:28 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 manpages-dev all 4.15-1 [2,217 kB]
내려받기 27.2 M바이트, 소요시간 2초 (11.7 M바이트/초)
Selecting previously unselected package libc-dev-bin.
(데이터베이스 읽는중 ...현재 170244개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../00-libc-dev-bin_2.27-3ubuntu1_amd64.deb ...
Unpacking libc-dev-bin (2.27-3ubuntu1) ...
Selecting previously unselected package linux-libc-dev:amd64.
Preparing to unpack .../01-linux-libc-dev_4.15.0-65.74_amd64.deb ...
Unpacking linux-libc-dev:amd64 (4.15.0-65.74) ...
Selecting previously unselected package libc6-dev:amd64.
Preparing to unpack .../02-libc6-dev_2.27-3ubuntu1_amd64.deb ...
Unpacking libc6-dev:amd64 (2.27-3ubuntu1) ...
Selecting previously unselected package libitm1:amd64.
Preparing to unpack .../03-libitm1_8.3.0-6ubuntu1~18.04.1_amd64.deb ...
Unpacking libitm1:amd64 (8.3.0-6ubuntu1~18.04.1) ...
Selecting previously unselected package libatomic1:amd64.
Preparing to unpack .../04-libatomic1_8.3.0-6ubuntu1~18.04.1_amd64.deb ...
Unpacking libatomic1:amd64 (8.3.0-6ubuntu1~18.04.1) ...
Selecting previously unselected package libasan4:amd64.
Preparing to unpack .../05-libasan4_7.4.0-1ubuntu1~18.04.1_amd64.deb ...
Unpacking libasan4:amd64 (7.4.0-1ubuntu1~18.04.1) ...
Selecting previously unselected package liblsan0:amd64.
Preparing to unpack .../06-liblsan0_8.3.0-6ubuntu1~18.04.1_amd64.deb ...
Unpacking liblsan0:amd64 (8.3.0-6ubuntu1~18.04.1) ...
Selecting previously unselected package libtsan0:amd64.
Preparing to unpack .../07-libtsan0_8.3.0-6ubuntu1~18.04.1_amd64.deb ...
Unpacking libtsan0:amd64 (8.3.0-6ubuntu1~18.04.1) ...
Selecting previously unselected package libubsan0:amd64.
Preparing to unpack .../08-libubsan0_7.4.0-1ubuntu1~18.04.1_amd64.deb ...
Unpacking libubsan0:amd64 (7.4.0-1ubuntu1~18.04.1) ...
Selecting previously unselected package libcilkrts5:amd64.
Preparing to unpack .../09-libcilkrts5_7.4.0-1ubuntu1~18.04.1_amd64.deb ...
Unpacking libcilkrts5:amd64 (7.4.0-1ubuntu1~18.04.1) ...
Selecting previously unselected package libmpx2:amd64.
Preparing to unpack .../10-libmpx2_8.3.0-6ubuntu1~18.04.1_amd64.deb ...
Unpacking libmpx2:amd64 (8.3.0-6ubuntu1~18.04.1) ...
Selecting previously unselected package libquadmath0:amd64.
Preparing to unpack .../11-libquadmath0_8.3.0-6ubuntu1~18.04.1_amd64.deb ...
Unpacking libquadmath0:amd64 (8.3.0-6ubuntu1~18.04.1) ...
Selecting previously unselected package libgcc-7-dev:amd64.
Preparing to unpack .../12-libgcc-7-dev_7.4.0-1ubuntu1~18.04.1_amd64.deb ...
Unpacking libgcc-7-dev:amd64 (7.4.0-1ubuntu1~18.04.1) ...
Selecting previously unselected package gcc-7.
Preparing to unpack .../13-gcc-7_7.4.0-1ubuntu1~18.04.1_amd64.deb ...
Unpacking gcc-7 (7.4.0-1ubuntu1~18.04.1) ...
Selecting previously unselected package gcc.
Preparing to unpack .../14-gcc_4%3a7.4.0-1ubuntu2.3_amd64.deb ...
Unpacking gcc (4:7.4.0-1ubuntu2.3) ...
Selecting previously unselected package libstdc++-7-dev:amd64.
Preparing to unpack .../15-libstdc++-7-dev_7.4.0-1ubuntu1~18.04.1_amd64.deb ...
Unpacking libstdc++-7-dev:amd64 (7.4.0-1ubuntu1~18.04.1) ...
Selecting previously unselected package g++-7.
Preparing to unpack .../16-g++-7_7.4.0-1ubuntu1~18.04.1_amd64.deb ...
Unpacking g++-7 (7.4.0-1ubuntu1~18.04.1) ...
Selecting previously unselected package g++.
Preparing to unpack .../17-g++_4%3a7.4.0-1ubuntu2.3_amd64.deb ...
Unpacking g++ (4:7.4.0-1ubuntu2.3) ...
Selecting previously unselected package make.
Preparing to unpack .../18-make_4.1-9.1ubuntu1_amd64.deb ...
Unpacking make (4.1-9.1ubuntu1) ...
Preparing to unpack .../19-libdpkg-perl_1.19.0.5ubuntu2.3_all.deb ...
Unpacking libdpkg-perl (1.19.0.5ubuntu2.3) over (1.19.0.5ubuntu2.2) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../20-dpkg-dev_1.19.0.5ubuntu2.3_all.deb ...
Unpacking dpkg-dev (1.19.0.5ubuntu2.3) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../21-build-essential_12.4ubuntu1_amd64.deb ...
Unpacking build-essential (12.4ubuntu1) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../22-libfakeroot_1.22-2ubuntu1_amd64.deb ...
Unpacking libfakeroot:amd64 (1.22-2ubuntu1) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../23-fakeroot_1.22-2ubuntu1_amd64.deb ...
Unpacking fakeroot (1.22-2ubuntu1) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../24-libalgorithm-diff-perl_1.19.03-1_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.03-1) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../25-libalgorithm-diff-xs-perl_0.04-5_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-5) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../26-libalgorithm-merge-perl_0.08-3_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-3) ...
Selecting previously unselected package manpages-dev.
Preparing to unpack .../27-manpages-dev_4.15-1_all.deb ...
Unpacking manpages-dev (4.15-1) ...
libquadmath0:amd64 (8.3.0-6ubuntu1~18.04.1) 설정하는 중입니다 ...
libatomic1:amd64 (8.3.0-6ubuntu1~18.04.1) 설정하는 중입니다 ...
make (4.1-9.1ubuntu1) 설정하는 중입니다 ...
libasan4:amd64 (7.4.0-1ubuntu1~18.04.1) 설정하는 중입니다 ...
libcilkrts5:amd64 (7.4.0-1ubuntu1~18.04.1) 설정하는 중입니다 ...
libubsan0:amd64 (7.4.0-1ubuntu1~18.04.1) 설정하는 중입니다 ...
libtsan0:amd64 (8.3.0-6ubuntu1~18.04.1) 설정하는 중입니다 ...
linux-libc-dev:amd64 (4.15.0-65.74) 설정하는 중입니다 ...
libdpkg-perl (1.19.0.5ubuntu2.3) 설정하는 중입니다 ...
liblsan0:amd64 (8.3.0-6ubuntu1~18.04.1) 설정하는 중입니다 ...
libmpx2:amd64 (8.3.0-6ubuntu1~18.04.1) 설정하는 중입니다 ...
dpkg-dev (1.19.0.5ubuntu2.3) 설정하는 중입니다 ...
libfakeroot:amd64 (1.22-2ubuntu1) 설정하는 중입니다 ...
libalgorithm-diff-perl (1.19.03-1) 설정하는 중입니다 ...
libc-dev-bin (2.27-3ubuntu1) 설정하는 중입니다 ...
manpages-dev (4.15-1) 설정하는 중입니다 ...
libc6-dev:amd64 (2.27-3ubuntu1) 설정하는 중입니다 ...
libitm1:amd64 (8.3.0-6ubuntu1~18.04.1) 설정하는 중입니다 ...
fakeroot (1.22-2ubuntu1) 설정하는 중입니다 ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
libgcc-7-dev:amd64 (7.4.0-1ubuntu1~18.04.1) 설정하는 중입니다 ...
libstdc++-7-dev:amd64 (7.4.0-1ubuntu1~18.04.1) 설정하는 중입니다 ...
libalgorithm-merge-perl (0.08-3) 설정하는 중입니다 ...
libalgorithm-diff-xs-perl (0.04-5) 설정하는 중입니다 ...
gcc-7 (7.4.0-1ubuntu1~18.04.1) 설정하는 중입니다 ...
g++-7 (7.4.0-1ubuntu1~18.04.1) 설정하는 중입니다 ...
gcc (4:7.4.0-1ubuntu2.3) 설정하는 중입니다 ...
g++ (4:7.4.0-1ubuntu2.3) 설정하는 중입니다 ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
build-essential (12.4ubuntu1) 설정하는 중입니다 ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
#include<stdio.h>
int main (int argc, char *argv[])
{
printf("hello, wolrd\n");
return 0;
}
dev@dev-desktop:~/hello$ gcc hello.c
dev@dev-desktop:~/hello$ ./a.out
hello, wolrd
dev@dev-desktop:~/hello$ gcc -o hello hello.c
dev@dev-desktop:~/hello$ ls
hello hello.c
dev@dev-desktop:~/hello$ ./hello
hello, wolrd
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char *argv[])
{
int i;
printf("argc=%d\n", argc);
for(i=0; i<argc;i++){
printf("argv[%d]=%s\n", i, argv[i]);
}
exit(0);
}
dev@dev-desktop:~/hello$ gcc -o args args.c
dev@dev-desktop:~/hello$ ./args
argc=1
argv[0]=./args
dev@dev-desktop:~/hello$ ./args 1
argc=2
argv[0]=./args
argv[1]=1
dev@dev-desktop:~/hello$ ./args 1 2
argc=3
argv[0]=./args
argv[1]=1
argv[2]=2
dev@dev-desktop:~/hello$ ./args 1 2 3
argc=4
argv[0]=./args
argv[1]=1
argv[2]=2
argv[3]=3
반응형
'OS > 리눅스 기초' 카테고리의 다른 글
12. stdio의 동작 확인 (0) | 2019.10.10 |
---|---|
8. stdio로 cat 명령어 만들어보기 (0) | 2019.10.10 |
6. 스트림 관련 라이브러리 함수(stdio)-1 (0) | 2019.10.10 |
책소개 (0) | 2019.10.02 |