我正在尝试在 Ubuntu v12.10 32 位上的 Eclipse CDT (v1.2.0.201212170456) 中编译以下 C 代码。
#include <openssl/bio.h>
int main(void)
{
return 0;
}
我的编译器是 arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2010q1-202) 4.4.1。我已经设置了 openssl 文件夹的路径,它位于/usr/include 中。当我在 #include
行上按 F3 时,Eclipse CDT 打开 bio.h 文件。当我编译代码时,出现大约 500 个错误,如下所示:
expected ';' before 'int' line 301, external location: /usr/include/openssl/bio.h
int (*bwrite)(BIO *, const char *, int);
<-- bio.h 中的第 300 行
int (*bread)(BIO *, char *, int);
<-- bio.h 中的第 301 行
或
expected ';', ',' or ')' before '*' token line 234, external location: /usr/include/openssl/bio.h
void BIO_set_flags(BIO *b, int flags);
<-- bio.h 中的第 233 行
int BIO_test_flags(const BIO *b, int flags);
<-- bio.h 中的第 234 行
我同时安装了 libssl 和 libssl-dev。我真的不知道可能是什么原因。请帮忙!
来自 CDT 的控制台输出:
arm-none-linux-gnueabi-gcc -I/usr/include -O0 -g3 -Wall -c -fmessage-length=0 -v -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.c"
最佳答案
回答我自己的问题。
我能够按照 SB. 给出的说明解决问题在 this SO thread .
当我静态链接到 OpenSSL 时,我已将以下文件复制到我在 Eclipse CDT 中的 C 项目。
- libcrypto.a
- libssl.a
关于C - 在 Ubuntu v12.10 上编译 OpenSSL 头文件的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14892626/