OpenSSL 관련 샘플파일을 컴파일하던중 오류..

psychedelphia의 이미지

처음 만나는 오류메세지라 상당히 당황스럽네여..ㅡㅡ;;

아직 모르는게 너무 많아서 그런거라 생각하시고 좋은 답변 부탁합니다..^^

[root@localhost ceolee]# gcc -o client.exe client.c
/tmp/ccrMBZZ0.o: In function `do_client_loop':
/tmp/ccrMBZZ0.o(.text+0x54): undefined reference to `BIO_write'
/tmp/ccrMBZZ0.o: In function `main':
/tmp/ccrMBZZ0.o(.text+0x83): undefined reference to `init_OpenSSL'
/tmp/ccrMBZZ0.o(.text+0x90): undefined reference to `BIO_new_connect'
/tmp/ccrMBZZ0.o(.text+0xb0): undefined reference to `handle_error'
/tmp/ccrMBZZ0.o(.text+0xc1): undefined reference to `BIO_ctrl'
/tmp/ccrMBZZ0.o(.text+0xdc): undefined reference to `handle_error'
/tmp/ccrMBZZ0.o(.text+0x124): undefined reference to `BIO_free'
collect2: ld returned 1 exit status

cellvian의 이미지

openssl 라이브러리와 링크를 해야 하는데...
library를 링크하지 않아서 symbol을 찾을 수 없다는 메시지네요. ^^

gcc -o client.exe client.c -lssl

이라고 하셔야 할것 같습니다.

김충길의 이미지

$ gcc -o client.exe client.c -lssl -lcrypto

혹 openssl-src/apps 디렉토리에 있는 client.c을 컴파일 하신다면
MAIN 매크로를 main으로 확장되도록 해야 할겁니다.

screen + vim + ctags 좋아요~