0
votes

I'm trying to create a PathValidation API using the OpenSSL Libary. Beacsue I just started with the OpenSSL Libary, I tried to get this code running http://www.frank4dd.com/howto/openssl/certverify.htm

Important to know I'm working on Windows 7 with the binary OpenSSL build and Eclipse C++.

When I'm trying to build the code from above I get

gcc -o PathValidationTest_C.exe verify.o 
In function `main':
C:\Users\workspace_c++\PathValidationTest_C\Debug/../verify.c:19: undefined reference to `OPENSSL_add_all_algorithms_noconf'
C:\Users\workspace_c++\PathValidationTest_C\Debug/../verify.c:20: undefined    reference to `ERR_load_BIO_strings'
C:\Users\workspace_c++\PathValidationTest_C\Debug/../verify.c:21: undefined reference to `ERR_load_crypto_strings'
...

And so on and on...

Then tried to link the libeay32.lib and ssleay32.lib from OpenSSL-Win64/lib which results in the same output..I included the ".h" from the OpenSSL-Win64/include/openssl folder.

Can anyone point me to a solution to solve this problem?

1
It means that you are linking wrong libraries. May be libraries are compiled with different compiler flags. Compile library with gcc and then link. - doptimusprime
I tried:gcc "-IC:\\OpenSSL-Win64\\include" "-IC:\\OpenSSL-Win64\\lib" -O0 -g3 -Wall -c -fmessage-length=0 "-LC:\\OpenSSL-Win64\\lib" -llibeay32 -lssleay32 -o verify.o "..\\verify.c" and gcc "-LC:\\OpenSSL-Win64\\lib" "-LC:\\OpenSSL-Win64" -o PathValidationTest_C.exe verify.o -llibeay32 -lssleay32 no changes.. - guest123
Check if there is any mismatch in architecture. Like, are you compiling 32-bit application and linking 64-bit library? - doptimusprime
hmm how do I check that? libeay32 stands for 32bit? I'm running on a 64bit Windwos system. IS there a way to tell eclipse to build a 32bit application? - guest123
Use dumpbin /machine <obj or library>|grep machine. For 64 bit, there will be x64 and for 32 bit, there will be x86 in the string. - doptimusprime

1 Answers

0
votes

Found the solution, I had to link the libeay.lib and ssleay.lib file from the OpenSSL-Win32 version folder!