게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
유닉스 gcc가 잘 안풀리네여;;
게시물ID : programmer_10146짧은주소 복사하기
작성자 : 나즈란
추천 : 0
조회수 : 526회
댓글수 : 12개
등록시간 : 2015/05/17 01:45:17
대략 숫자 5를 입력하면  1부터 5까지 입력한 숫자를 더해서 그 값을 출력하는 프로그램인데

main.c파일                            

#include "abc.h"
int main()
{
input();
process();
output();
return 0;
}

abc.h파일

#include <stdio.h>
void input();
void process();
void output();

input.c파일

#include "abc.h"
void input()
{
        int a;
        printf("input number");
        scanf("%d", &a);
}

process.c파일

#include "abc.h"
void process()
{

        int i, a, result;
        for(i=0;i<=a;i++)
{
        result=i+result;
}
}

output.c파일


#include "abc.h"
void output()
{
        int result;
        printf("output is %d", result);
}

makefile파일

a.out: main.o intput.o process.o output.o
        gcc  -o main.o input.o process.o output.o
main.o: main.c abc.h
        gcc  -c main.c
input.o: input.c abc.h
        gcc  -c input.c
process.o: process.c abc.h
        gcc  -c process.c
output.o: output.c abc.h
        gcc -c output.c


결과가 이렇게 나오네요
$ bash makefile
makefile: line 1: a.out:: command not found
gcc: input.o:해당파일이나 디렉토리가 없음
gcc: process.o: 해당파일이나 디렉토리가 없음
gcc: output.o: 해당파일이나 디렉토리가 없음
gcc: no input files
makefile: line 3: main.o:: command not found
makefile: line 5: input.o:: command not found
makefile: line 7: process.o:: command not found
makefile: line 9: output.o:: command not found


 $ls
abc.h      input.c  main.c  makefile  output.o   process.o
abc.h.gch  input.o  main.o  output.c  process.c



이것저것 알아보고 바꿔보고 인터넷 찾아봐도 뭐가 문제인지 모르겠습니다;;
목적 파일이 안만들어져서 그런건가 싶어도 막상 목적파일이 만들어져 있으니;
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호