首页 > 技术文章 > 编译问题

listenerln 2017-06-21 10:02 原文

1.

用 math库

错误信息:

/tmp/ccmJmMoE.o: In function `test':
test.c:(.text+0x19): undefined reference to `log10'
collect2: ld returned 1 exit status

gcc -Wall  main.o test.o  -lm -o test

-lm 要放到 .o 后面

 

 

 

2.

libssl

libssl.so: undefined reference to `BN_CTX_free'
libssl.so: undefined reference to `X509_free'

...

编译时加上 ssl 和 crypto 两个

-lssl -lcrypto 

推荐阅读