mardi 18 juillet 2017

Undefined reference to `CreateCompatibleBitmap@12' with OpenSSL 1.0.2

This is the code I use in Codeblocks on Windows 10 with OpenSSL. But there are some errors.

#include <openssl/rsa.h>
int main()
{
    RSA *r;
    int bits=512,ret;
    unsigned long e=RSA_3;
    BIGNUM *bne;
    r=RSA_generate_key(bits,e,NULL,NULL);
    RSA_print_fp(stdout,r,11);
    RSA_free(r);
    bne=BN_new();
    ret=BN_set_word(bne,e);
    r=RSA_new();
    ret=RSA_generate_key_ex(r,bits,bne,NULL);
    if(ret!=1)
    {
        printf("RSA_generate_key_ex err!\n");
        return -1;
    }
    RSA_free(r);
    return 0;
}    

The link errors:

\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `GetDeviceCaps@8'|
\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `GetDeviceCaps@8'|
\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `CreateCompatibleBitmap@12'|
\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `GetObjectA@12'|
\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `GetDIBits@28'|
\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `DeleteObject@4'|

What's wrong?




Aucun commentaire:

Enregistrer un commentaire