Skip to content

분할컴파일 gcc로 컴파일 문제 #19

Description

@manduiscoming

2048.c(main함수라고 보면됨), 2048Color.h(보드판 그려주는 함수부분의 헤더), 2048Color.c(보드판 그려주는 함수 실행부분)

  1. 가장 먼저 해야할일은 2048.c 와 2048Color.c 를 기계어가 해석가능한 object 코드로 만드는 일이다. 오브젝트 코드는 gcc에 -c 옵션을 이용해서 만들어낼 수 있다.
    gcc -c 2048Color.c 2048.c

  2. 이제 2048.o 와 2048Color.o 라는 파일이 만들어진걸 확인할 수 있을 것이다. 확장자 .o는 이 파일이 오브젝트 파일이라는 것을 알려준다. 이제 두개의 object 파일을 링크시켜서 실행파일을 만들면 된다. -o 옵션을 이용하면, 만들어진 오브젝트 파일들을 합쳐줄 수 있다.
    gcc -o 2048 2048Color.o 2048.o

  3. 파일 실행!
    ./2048

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions