使用sk_X509_pop_free升级OpenSSL会导致编译器错误

时间:2012-02-22 20:52:33

标签: c++ openssl

当我将OpenSSL从0.9.8升级到1.0.0E时,我现在遇到编译器错误。以下是简化版本:

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 个答案:

答案 0 :(得分:2)

以下代码删除了错误:

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