'linkage error when compiling with openssl as static library

Trying to compile my program with openssl as static library with the following :

gcc -g -Ifolder1/include  -Iopenssl/include -Ifolder2_include -c main.c  folder1/lib/utils.c  folder1/lib/plus.c  folder1/lib/functions.c
gcc -g -o prog.exe -Ifolder1/include -Ifolder2_include main.o utils.o plus.o functions.o -Lopenssl/windows/static -lcrypto -Iopenssl/include

but i get this linkage errors(functions from openssl):

folder1/lib/functions.c:104: undefined reference to `SHA256_Init'
folder1/lib/functions.c:108: undefined reference to `SHA256_Update'
folder1/lib/functions.c:113: undefined reference to `SHA256_Update'
folder1/lib/functions.c:118: undefined reference to `SHA256_Update'
folder1/lib/functions.c:125: undefined reference to `SHA256_Final'
folder1/lib/functions.c:129: undefined reference to `SHA256_Final'

Any idea what I'm doing wrong ? I tried a different combinations of sequences of the same flag but none worked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source