我已经从源代码构建了OpenSSL(一个故意的旧版本;用它构建./config && make && make test)并且更愿意使用我构建的内容而不用make install链接我的程序.
失败的命令是:
gcc -Wall -Wextra -Werror -static -Lopenssl/openssl-0.9.8k/ -lssl -lcrypto
-Iopenssl/openssl-0.9.8k/include -o myApp source1.o source2.o common.o`
Run Code Online (Sandbox Code Playgroud)
我收到一系列类似的错误:
common.c:(.text+0x1ea): undefined reference to `SSL_write'
Run Code Online (Sandbox Code Playgroud)
这让我觉得我的OpenSSL有点时髦.如果我-Lopenssl/openssl-0.9.8k/从命令中省略,则错误将更改为无法:
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
Run Code Online (Sandbox Code Playgroud)
我是否错误地编译了OpenSSL?或者我该如何最好地解决这个问题?
当使用像 pkg-config 这样的工具(参见这里)时,如何知道库名称应该是什么?它并不总是直观的。例如,DLIB 不适用于
pkg-config --cflags dlibpkg-config --cflags libdlibpkg-config --cflags dlib-19.9我通常必须发出类似的命令sudo ldconfig -p | grep dlib,但所做的只是 return libdlib.so,这也不起作用。
专家如何解决这个问题。他们只是知道所有图书馆的名称吗?
^这不是一个重复的问题^
更新:
我对编程很新,我现在才刚刚遇到makefile.
在过去的几个月里,我从各个地方下载了一堆教程和源代码; 到目前为止,我只使用VS解决方案,并一直在避免它们.
我在google上看过多种使用Makefiles的方法,但它们的复杂性各不相同......
我对它们没有任何线索或如何使用它们.谢谢.
编辑(重新措辞):
总而言之,由于明显的混淆,我的问题是(并且一直是):
1) Is there a good tutorial that comes recommended or is it easy to get started with Makefiles?
2) How do you launch and run an existing Makefile? And,
3) Do Makefiles hold any vital data about the program or could I just use the `.h` and `.cpp` files that come with them in a new solution built from scratch?
Run Code Online (Sandbox Code Playgroud)