0

I am getting a linker error, I'll post it at the bottom. The goal is only to build the example SSL client from boost.

The overall question is just to find the simplest c++ way to download some xml from https://classic.wowhead.com/item=19351&xml

Edit: The problem has evolved as I've continued to work on it. I now realize that I had no idea how to use a static or dynamic library or how either worked. I know a little now.

I've built OpenSSL following this youtube video verbatim and it seems to have built properly. https://www.youtube.com/watch?v=PMHEoBkxYaQ

I'm now using the shorter example https://stackoverflow.com/a/7577229/2247872 and finally got it working which has helped enormously in identifying where the other errors are. I had to be really careful that I was using x86 Debug for everything and then added D:\out\lib\x32\Debug\include to my include directories, d:\out\lib\x64\debug\lib to my linker libraries, and libssl.lib and libcrypto.lib to my additional dependencies. One thing that was helpful is that if #include wasn't underlined by Visual Studio I knew I at least had the include directory set correctly.

I've made two copies of my program, one uses static linking the other dynamic linking. To get the dynamic linking one to work I had to copy the libssl-3.dll and libcrypto-3.dll files in to the same place as my executable.

Right now I'm still fighting with boost on the static one.

#include <boost/beast/core.hpp>  //all of these are fine
#include <boost/beast/http.hpp>
#include <boost/beast/version.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <openssl/ssl.h>
#include <openssl/conf.h>
//#include <boost/beast/ssl.hpp>  //this line is giving me 196,429 errors.
//#include <boost/asio/ssl/error.hpp> ////this line is giving me 196,429 errors.
//#include <boost/asio/ssl/stream.hpp>  //this line is giving me 196,429 errors.

Original Post: I found similar questions on SO but the names of the OpenSSL libraries have changed and I need a current answer to setting up my MS Visual Studio 2019 project properties properly.

I do not need to build these files (I don't think). All I want to do is get the boost example here https://www.boost.org/doc/libs/master/libs/beast/example/http/client/sync-ssl/http_client_sync_ssl.cpp working.

Question 1: Which of the options from https://wiki.openssl.org/index.php/Binaries or https://slproweb.com/products/Win32OpenSSL.html do I want? For example I don't understand the difference between a pre-compiled build without external dependencies to VS2019 or the one on that bottom pre-compiled build with external dependencies to VS2019. My original choice was the one from the 2nd website that said 1.1.0L "this is the standard version for x64".

I chose the option to install the library files in the Windows System directory. I see files named c:\windows\system32\libcrypto.dll c:\windows\system32\libssl-1_1x64.dll

I added C:\Windows\System32 to my path environment in windows and restarted the computer. In VS project properties: My C/C++ --> General --> Additional Include Directories are:

    d:\cpp\boost_1_72_0
    d:\OpenSSL-Win64\include

My Linker --> General --> Additional Library Directories

    d:\openssl-win64\lib
    d:\openSSL-win64\lib\VC
    d:\openSSL-win64\lib\VC\static
    c:\windows\system32\
    d:\opensll-win64\StaticDLLsIGuess (this is a directory I put files in from a 2nd attempt to solve the problem, by downloading two files from https://indy.fulgan.com/SSL/ but they need in ".a"

    d:\cpp\boost_1_72_0\stage\lib

In Linker --> Additional Dependencies I tried to list:

    libssl.lib
    libcrypto.lib 

But when those were there I got a different, simple error saying "libssl.lib" couldn't be found which I found baffling as pretty much my entire computer is in my build options. So why that is happening is question 2. Same thing for

      c:\windows\system32\libssl-1_1x64.dll

I know that file is there, but when I put libssl-1_1x64.dll in additional dependencies I get a link1104 error that it's not found even though c:\windows\system32 is in additional library directories.

Question 3 is what libraries do I actually need? There are libraries in my system 32 directory, libraries in D:\OpenSSL-Win64\lib, and libraries in D:\OpenSSL-Win64\lib\VC

This is the actual error I'm getting but I cannot interpret what linker error messages actually mean.

Severity Code Description Project File Line Suppression State Error

    LNK2019 unresolved external symbol _CONF_modules_unload referenced in function "public: __thiscall 
    boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (?? 
    1do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ)   PreparedParser   
    D:\cpp\PreparedParser\PreparedParser\PreparedParser.obj 1   

Edit: I am still in the process of trying to fix this myself, and I'm realizing that part of the problem is that I had no understanding of the difference between a dynamic and static library. I'm trying to figure that out now. Also, https://www.youtube.com/watch?v=PMHEoBkxYaQ is a video on how to compile OpenSSL and I'm doing that.

Edit April 18 11am: Side questions: If I download a .lib from somewhere, how do I put it in my program? Do I #include the lib file? Do I add it to additional dependencies? How do I know what functions are in it? How is it different for .dlls?

  • 1
    A few clicks from that wiki.openssl.org page in your question, you will find yourself looking at https://www.openssl.org/community/mailinglists.html which happens to mention the openssl-users mailing list, that's described as "any questions about building, using, etc., OpenSSL itself". As you surely must know, all free software projects typically have these mailing lists or forums that are dedicated exclusively to discussion of the project. I'm curious what made you think a generic web site, like stackoverflow.com is a better place for this kind of a question than the project's own forums? – Sam Varshavchik Apr 18 '20 at 01:35
  • I don't know if this is a linker error, a VS 2019 build environment error, or an openSSL error. Also, there were nearly identical posts on SO but they're just outdated. https://stackoverflow.com/questions/11383942/how-to-use-openssl-with-visual-studio – user2247872 Apr 18 '20 at 03:34
  • I'm curious: do you think it's more likely that you'll find someone with this specialized knowledge on a generic web site, like stackoverflow, or on a mailing list full of people who do nothing but build and develop with OpenSSL, all day? – Sam Varshavchik Apr 18 '20 at 03:37

0 Answers0