일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- javascript
- nginx
- primitive type
- REST
- sinopia
- Travis CI
- ubuntu
- 인프런
- Unit-test
- dict
- Lodash
- 개인정보수정
- sanghaklee
- {}
- RESTful
- GIT
- Linux
- python
- PowerMock
- Code-coverage
- NPM
- API
- JaCoCo
- Coveralls
- ECMAScript2015
- java
- ATOM
- node.js
- AWS
- Gitbook
Archives
- Today
- Total
이상학의 개발블로그
[Mac] Mac 에서 gcc 로 hello.c 컴파일 하기 본문
Mac에서 수업시간에 c 프로그램을 컴파일하는 과제가 있다.
Xcode에서 프로젝트 만들고 할 수 있는데 기본적인 컴파일과 빌드만 하기 때문에 gcc를 이용했다
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
printf("hello c\n"); | |
} |
"hello c" 를 출력하는 간단한 예제이다.
비쥬얼 스튜디오라면 바로 cmd에 "hello" c 와 엔터를 입력하세요.. 라는 글자가 나오겠지만
$ gcc hello.c
아무것도 안나온다.
현재 터미널에 어떤 파일이 있는지 확인하자
$ ls
a.out 이라는 이상한 파일이 생겼다.
$ ./a.out
이렇게 하면 원하는 결과를 얻을 수 있다.
$ a.out 은 안된다!!
그러나 파일명이 마음에 안든다.
$ gcc hello.c -o hello
$ gcc [컴파일 할 파일] -o [만드려는 이름]
-o 옵션으로 a.out을 hello로 변경했다.
'OS > Apple(iPhone&Mac)' 카테고리의 다른 글
[아이폰/맥] iPhone / Mac 아이폰 유선 미러링 iPhone mirroring (0) | 2016.03.29 |
---|
Comments