2012-02-22 57 views
3

當我從0.9.8更新OpenSSL到1.0.0E我現在得到一個編譯器錯誤。下面是一個簡化版本:升級OpenSSL導致編譯器錯誤與sk_X509_pop_free

1: #include <openssl/pem.h> 
2: 
3: int main(int argc, char* argv[]) 
4: { 
5: STACK_OF(X509)* certs = NULL; 
6: sk_X509_pop_free(certs, X509_free); 
7: } 

我得到以下錯誤:

CC -g0 -I/openssl/ssl/include main.cc -o main -L/openssl/ssl/lib -lcrypto -lssl 
"main.cc", line 6: Error: Different types for "?:" (extern "C" void(*)(x509_st*) and void(*)(x509_st*)). 
"main.cc", line 6: Warning (Anachronism): Formal argument func of type extern "C" void(*)(void*) in call to sk_pop_free(stack_st*, extern "C" void(*)(void*)) is being passed void(*)(void*). 

二進制:ELF 32位MSB可執行SPARC32PLUS第1版,V8 +必選,動態鏈接的,不剝離。
編譯器:CC:Sun C++ 5.9 SunOS_sparc 2007/05/03。
操作系統:的Solaris 10

+1

請明確的類型轉換嘗試。 – doptimusprime 2013-04-28 15:08:02

+0

謝謝@dbasic。明確的轉換刪除了錯誤,只留下警告。程序運行。我沒有證實內存已被釋放。 – Hitman 2013-05-14 16:35:50

+0

嗨,你可以請提到typcasting你做了最後的可執行代碼? – pratibha 2014-03-29 10:11:36

回答

2

下面的代碼刪除錯誤:

sk_X509_pop_free(certs, (void(*)(x509_st*))X509_free);