0

在编译我编写的 ac 代码时出现以下错误。我知道问题出在头文件中。谁能告诉我定义这些函数需要哪些头文件。

sign.c: In function ‘main’:
sign.c:78: warning: assignment makes pointer from integer without a cast
/tmp/ccnsSeHy.o: In function `sign_data_evp':
sign.c:(.text+0x68): undefined reference to `check_ssl_rv'
sign.c:(.text+0xd5): undefined reference to `check_ssl_rv'
sign.c:(.text+0x13e): undefined reference to `check_ssl_rv'
/tmp/ccnsSeHy.o: In function `main':
sign.c:(.text+0x1ca): undefined reference to `initialize'
sign.c:(.text+0x1d6): undefined reference to `select_engine'
sign.c:(.text+0x20a): undefined reference to `sign_data'
sign.c:(.text+0x216): undefined reference to `clean_engine'
sign.c:(.text+0x21b): undefined reference to `clean_up'
collect2: ld returned 1 exit status

到目前为止我使用的头文件是:

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <netdb.h>
#include <unistd.h>
#ifdef __VMS
#include <socket.h>
#include <inet.h>

#include <in.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif

#include <openssl/crypto.h>
#include <openssl/ssl.h>
#include <openssl/err.h>

操作平台:Linux 提前致谢。

4

2 回答 2

1

你理解错了。它不会抱怨未知的函数原型,它会在链接期间抱怨。所以你可能忘记链接一些库或一些目标文件。

于 2012-06-21T09:25:28.153 回答
0

试试这个 gcc sslprogname.c -o sslprogname -Wl,-Bstatic -lssl -Wl,-Bdynamic -lssl3 -lcrypto。它对我有用

于 2014-05-20T04:39:51.987 回答