GCC
-
gcc 모듈 c 파일 이용해 컴파일하기언어/C 2020. 1. 13. 12:33
당연히 c 개발을 하면 c파일과 header파일로 파일을 분할해서 관리한다. 그래서 main.c와 모듈이 되는 c파일을 같이 컴파일하는 방법에 대해 알아보았다. 1. file 준비 현 나의 상황으로는 main.c anc.c, anc.h functional.c, functional.h secondary_path.c, secondary_path.h synchronizer.c, synchronizer.h common.h 로 프로젝트가 이루어져 있다. 모두 같은 디렉토리에 존재한다. header file들은 현재 디렉토리에 꼭 존재해야 한다. Visual studio에서는 common.h에서 stdlib.h 등 필수 헤더파일들을 include했지만 리눅스에서 gcc를 이용해 컴파일할 때는 common.h의 #i..
-
gcc 설치 및 사용법언어/C 2020. 1. 13. 12:31
리눅스에서 C언어 개발 환경을 구축하기 위해 gcc를 사용해본다. 1. 설치 보통 우분투를 설치하면 gcc는 설치되어있다. 아래의 명령어를 통해 설치여부를 확인해보자. gcc output: gcc: fatal error: no input files compilation terminated. 이렇게 나오면 설치되어 있는 것이다. 버젼을 확인해보자. gcc --version output: gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not e..