개발

우분투에서 gcc 사용하기

에드몽단테스 2008. 3. 26. 13:15
우분투에서 간단한 c파일을 컴파일해보자.

#include

int main()
{
    char *str = "Hello";
    printf(str);
    return 0;
}


컴파일을 시도하면 다음과 같은 오류가 나타난다.

dantes@dantes-desktop:~/test$ gcc -o a a.c
a.c:1:19: error: stdio.h: No such file or directory
a.c: In function ‘main’:
a.c:6: warning: incompatible implicit declaration of built-in function ‘printf’


이것은 다음과 같이 해결할 수 있다.
dantes@dantes-desktop:~/test$ sudo apt-get install build-essential


설치도중 우분투 cd를 넣으라고 나온다. 꼭 준비하자.

반응형