Friday, January 05, 2007

컴파일러가 지원하지 않는 확장자를 가진 파일을 컴파일 해서 실행파일 만들기.

프로그래밍 이야기 : *.c ==> *.i ==> *.s ==> *.o ==> 실행파일
-x 옵션 써서 컴파일러가 지원하지 않는 확장자를 가진 파일을 컴파일 해서 실행파일 만들기.
    *.c ==> *.i
            lys]# gcc -E test.c -o test.i.un
    *.i ==> *.s
            lys]# gcc -S -x cpp-output test.i.un -o test.s.un
    어셈블러는 기본적으로 확장자가 *.i(C 소스코드)인
    전처리된 결과 파일을 입력으로 받기 때문에 -x cpp-output 옵션 사용
    *.s ==> *.o
            lys]# gcc -c -x assembler test.s.un -o test.o.un
    test.s가 assembler 파일임을 알리기 위해 assembler 옵션을 사용
    *.o ==> 실행파일
            lys]# gcc test.o.un -o test

0 Comments:

Post a Comment

<< Home