[질문] 이거 어떻게 쓰는거예염?

익명 사용자의 이미지

요새 linux 에서 c++ 공부를 하고 있는데 다음의 STL 예제는 어떻게 컴팔
해야 하는지 알수가 없네요..

stl_list.C

#include
#include

int main(int argv, char *argc[]){

list lst;

return 0;
}

이렇게 소스를 만들고 다음과 같이 컴파일을 했습니다.

[userttma@localhost exam03]$ gcc -o lst stl_list.C
/tmp/ccB1YRdQ.o In function
`__malloc_alloc_template<0>_S_oom_malloc(unsigned int)'
/tmp/ccB1YRdQ.o
(.__malloc_alloc_template<0>gnu.linkonce.t._S_oom_malloc(unsigned
int)+0x1a) undef
ined reference to `endl(ostream &)'
/tmp/ccB1YRdQ.o
(.__malloc_alloc_template<0>gnu.linkonce.t._S_oom_malloc(unsigned
int)+0x27) undef
ined reference to `cerr'
/tmp/ccB1YRdQ.o
(.__malloc_alloc_template<0>gnu.linkonce.t._S_oom_malloc(unsigned
int)+0x2c) undef
ined reference to `ostreamoperator<<(char const *)'
/tmp/ccB1YRdQ.o
(.__malloc_alloc_template<0>gnu.linkonce.t._S_oom_malloc(unsigned
int)+0x37) undef
ined reference to `ostreamoperator<<(ostream &(*)(ostream &))'
collect2 ld returned 1 exit status

그랬더니 위와 같은 에러 메시지가 쏟아져 나오네요..

이럴때는 어떻게 해야 하나요?

default allocator 를 지정해줘도 문제가되고 안해줘도 문제가되고..

STL은 쓰기에 까다로운듯 합니다.

적용환경은 hancomlinus gcc 2.96 입니다.

감사합니다.

익명 사용자의 이미지

...........