I have the following code in the file
RSA *rsa = RSA_generate_key((const int) 1024,(const int) 3, 0, 0);
gcc -I../include/ -L . -lcrypto -lssl rsatest.c
undefined reference to `RSA_generate_key'
gcc -I../include rsatest.c -L . -lcrypto -lssl
rand_win.o and c_zlib.o
-lz and -lgdi32
Change the order in your gcc command.
gcc -I../include/ rsatest.c -L . -lcrypto -lssl
As far as I know linker has a list of undefined symbols. When it processes libcrypto.a and libssl.a it does not have anything in the list of undefined symbols so he just drops the libraries. Then after processing rsatest it has something in its list but it does not look for symbols in already processed libraries.