2015년 11월 7일 토요일

How to setup GCC (GNU Complier Collections) on Mac OS X and test to use Vim.

If you contact GCC firstly as this page, please don't believe everything. quest yourself about this page.

 My development environment
: Mac OS X 10.11.1 El Capitan on Macbook pro 2015 early
  Xcode 6.3.1

* I am studying the book; 64비트 멀티코어 OS 원리와 구조.  GCC installation is first procedure for it.
  It is similar to '2.1 GCC 설치' page 50 to  '2.2 크로스 컴파일러 만들기' page 69. but It is for Windows. So I need to do on Mac OS X.

1. Open Terminal
 (Ctrl+ Space)  terminal.app

2. type   $xcode-select --install     (* "$" means on terminal)
    *If you don't know you have GCC or not, type this sentence $ gcc --version

3. click Install(설치)

4. type, too. $gcc -v

completed installation GCC.


until now, how to test GCC on Vim
Vim (old version Vi) is already installed on Mac OS X.
open your terminal.

$vi File_Name       example) $vi test.c

1. Can input codes after pushing a or i or u button.

#include <stdio.h>

int main( int argc, char** argv)
{
     printf("Hello World\n");
     return 0;
}

2. push ESC.

3. when your cursor located bottom, type :w       (it means save)

[Common Test]

4. $gcc -o test.out   (It makes test.out file and It is for test)

5. $ ./test.out   

You can see  Hello world


[My case Test]
4. $gcc -m32 -o test32 test.c
    $gcc -m64 -o test64 test.c 

5. $./test32
    $./test64

If you see  Hello World,  Your GCC can apply 64bit and 32bit.






'ls' command to see files on this location.


-Reference
Book <64비트 멀티코어 OS 원리와 구조 1>

How to use Vim (in Korean)
http://www.joinc.co.kr/modules/moniwiki/wiki.php/Site/Vim  

Setup Development Environment for 64비트 멀티코어 OS 원리와 구조
http://nayuta.net/64%EB%B9%84%ED%8A%B8_%EB%A9%80%ED%8B%B0%EC%BD%94%EC%96%B4_OS_%EC%9B%90%EB%A6%AC%EC%99%80_%EA%B5%AC%EC%A1%B0/OS_X%EC%97%90%EC%84%9C_%EA%B0%9C%EB%B0%9C%ED%99%98%EA%B2%BD_%EA%B5%AC%EC%B6%95%ED%95%98%EA%B8%B0


댓글 없음:

댓글 쓰기