首页 > 解决方案 > Using Embarcadero 10.1 Berlin with OpenSSL (C++)

问题描述

I'm in the midst of trying to get OpenSSL and Embarcadero 10.1 Berlin to play nice.

I have a C++ project (VCL Form) that imports OpenSSL libraries, and then makes use of their functions (ex: openssl/evp.h).

I am still fairly new to the Embarcadero IDE, along with C++, as well as OpenSSL. Not a great combo, but this set-up is what I am required to use.

When I first started going down this OpenSSL rabbit hole, my project was unable to find my "#include"s. After dinking around in the Project Options, I set the "include" path to add the "include" folder in my OpenSSL installation, and the "lib" path to add the "lib" folder in my OpenSSL installation.

This solved my issue of not being able to find the files, but now I am getting linker issues:

[ilink64 Error] Error: Unresolved external '_EVP_EncryptInit_ex' referenced from C:\filepathhere

I have searched online for solutions to this problem, and there are many suggested solutions for this particular problem! However, none of them are resolving my issue, and I am unsure if that is because they are incorrect solutions or perhaps I am not executing them properly. It is hard to tell since most of this is new to me.

My project's target platform is set to Win64, so I initially thought that perhaps the OpenSSL library I was linking to was for Win32. I have tried switching the target platform to Win32, as well as installing a seperate OpenSSL for 64-bit, but neither of these solutions have worked. (When switching the target platform to Win32, the error becomes [ilink32 Error] instead of [ilink64 Error]).

I then tried going through the following suggested solutions:

linker error with openssl (trying SH1 example)

How do I solve an unresolved external when using C++ Builder packages?

https://forums.embarcadero.com/thread.jspa?threadID=113166

Use OpenSSL in C++Builder

But, none of them succeeded. To make matters worse, the listed solutions vary so greatly that it becomes increasingly difficult to know whether or not I had stumbled upon the solution at one point (and executed it improperly) and am now simply wasting my time looking for a new solution.

I'd also tried using Embarcadero's official wiki page on OpenSSL, but the installation steps did not help. http://docwiki.embarcadero.com/RADStudio/Berlin/en/OpenSSL

I am now at my wit's end. All I want to do is use OpenSSL with Embarcadero 10.1, using C++, on a Windows 10 machine, to develop a 64-bit application.

Any and all help is greatly appreciated. I apologize if this ends up being a duplicate question. Thanks in advance to all.

标签: openssllinker-errorsc++builder

解决方案


问题已解决 - 从另一个论坛上的另一个用户那里获得了帮助。

上述链接之一(在 C++Builder 中使用 OpenSSL)的答案涉及从 OpenSSL 的 .dll 文件中构建库。这些库是使用 implib(用于 32 位)和 mkexp(用于 64 位)命令构建的。有关这些命令及其工作原理的更多详细信息,请参阅链接线程。

我已将项目选项设置为指向这些创建的库文件(在我的情况下为 .a),但已被告知它们也需要添加到项目本身中。将它们添加到项目后,链接器错误已得到解决。

希望这对将来可能遇到相同问题的其他人有所帮助。干杯。


推荐阅读