问题描述
我用 Openssl 用 C 和 C++ 编写了简单的应用程序.我是这样编译的:
I wrote simple apps with Openssl in C and C++. I compile them like this:
一切正常,但前提是你安装了 Openssl.
And its all ok but only, when you have Openssl installed.
我想编译它,以便我可以在没有 Openssl installend(类似 linux 的操作系统)的操作系统上运行它们.我试过这个:
I would like to compile it that I can run them on OS where theres no Openssl installend (linux-like OS). I tried this:
和 C++ 一样:
但是有这些错误:
我怎样才能做到这一点?我记得不久前我做了这个,但现在,呃,忘记了怎么做.我使用的是 Ubuntu 13.04 x64 - 会不会有问题?
How can I make this? I remember that a while ago I did this but now, erm, forgot how to do it. Im on Ubuntu 13.04 x64 - can it be an issue?
推荐答案
我在尝试使用 openssl 库静态编译一个简单的 DES 程序时遇到了类似的问题.我使用了 -lcrypto -lz -ldl -static-libgcc
并且它对我有用.没有警告或错误.
I had a similar issue trying to statically compile a simple DES program using the openssl lib. I used -lcrypto -lz -ldl -static-libgcc
and it worked for me. No warnings or errors.
这篇关于如何在 C/C++ 中使用静态链接与 OpenSSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!