LINUX에서 순서가 매우 중요한 것 같습니다. T.T
gcc test.c
test.c:(.text+0x49): undefined reference to
test.c:(.text+0x71): undefined reference to
test.c:(.text+0x82): undefined reference to
test.c:(.text+0xaa): undefined reference to
test.c:(.text+0xbb): undefined reference to
test.c:(.text+0xe3): undefined reference to
test.c:(.text+0xf4): undefined reference to
test.c:(.text+0x130): undefined reference to
test.c:(.text+0x141): undefined reference to
test.c:(.text+0x17d): undefined reference to
test.c:(.text+0x18e): undefined reference to
test.c:(.text+0x1ca): undefined reference to
test.c:(.text+0x1db): undefined reference to
test.c:(.text+0x217): undefined reference to
test.c:(.text+0x228): undefined reference to
test.c:(.text+0x27d): undefined reference to
test.c:(.text+0x28e): undefined reference to
test.c:(.text+0x2d3): undefined reference to
test.c:(.text+0x30c): undefined reference to
일단 뒤에 함수명은 이유가 있어서 제끼고 ㅋㅋㅋ
to 뒤에는 함수명이 옵니다. ^^;;
네이버를 열심히 뒤지다 보니
저 함수들을 포함하는 라이버러리가 없다 그래서
T.T
gcc -lmylib test.c
이렇게 했습니다.
그래도 똑같이 나는 겁니다.
gcc -lmylib -L/usr/local/lib test.c
이렇게 해주라 그래서 또 해봤는데 똑같은 오류가 납니다. ^^;;
그래서 또 네이버와 구글을 전전 긍긍하다가
KLDP에서
순서 이야기를 살짝 본 기억이 나서 T.T
gcc test.c -lmylib -L/usr/local/lib
이렇게 했습니다.
T.T
a.out가 나옵니다. 흑흑흑
gcc -o test.exe test.c -lmylib -L/usr/local/lib
이렇게 하시면
a.out가 아니고
test.exe로 실행 파일을 생성 할 수 있습니다.
출처 : http://talkit.tistory.com/124
'System > Linux' 카테고리의 다른 글
ARM 크로스 컴파일 환경 구축하기 (0) | 2016.04.22 |
---|---|
C/C++ library 만들기 (0) | 2016.04.22 |
라이브러리 만들기 (0) | 2016.04.22 |
Make 기반 빌드 시스템: Makefile 기초 (0) | 2016.04.22 |
남의 라이브러리 컴파일시 막힐 경우 (0) | 2016.04.22 |