4

我的 iPhone 应用程序中的一些 C 代码需要 openssl 库。所以我把这个库放到了我的项目中。

但是当我编译它时,Xcode 会抛出一些错误:

错误:openssl/ssl.h:没有这样的文件或目录

这是我的代码,包括:

 #include <openssl/ssl.h>

Xcode 中的目标设置:

替代文字 http://img17.imageshack.us/img17/2266/bild3tez.png

我错过了正确链接它的哪一步?

4

3 回答 3

3

这不是链接问题。这是预处理器无法找到头文件。您需要检查该标头的最终位置,并可能更改 Xcode(或您的项目)的设置以包含该位置。

于 2009-03-06T09:00:40.017 回答
2

由于这似乎适用于 iPhone,因此您不会找到它。OpenSSL 在 iPhone 上不可用,对第三方应用程序也不可用。为模拟器编译可能会起作用,因为它有各种真实设备没有的东西。让它为手机编译是不可能的——找不到标头,因为它不存在,如果你以某种方式欺骗它使用不同的副本,它将无法链接。

于 2009-03-06T17:56:04.503 回答
1

好吧,当找不到链接库时,我现在去这里查看我需要链接到哪个库/框架。

我知道您的问题是其他问题,但这对其他人应该有用。

http://developer.apple.com/iPhone/library/documentation/Xcode/Conceptual/iphone_development/910-A-iPhone_Simulator_Frameworks/iphone_simulator_frameworks.html

Also, to link the libraries, go to the targets area of xcode. Expand that area until you find "link binary with libraries". Right click and add existing framework. Click the plus at the bottom and then find the library you need and add it.

于 2009-08-22T16:12:12.323 回答