c - 错误 : unknown type name 'CURL'

标签 c curl libcurl openwrt

我编写了一个 C 库,它利用 libcurl 库与 REST API 进行交互。我在基于 debian 的系统上写了这个,但现在我试图在运行 OpenWRT 发行版的 Arduino 上使用它。在尝试使用它时,我注意到编译器尝试使用 libcurl 库时出现问题,因此我编写了一个 super 简单的程序来测试它。

#include <curl/curl.h>

void main() {
    CURL *curl;
}

然后我就这样编译了...

gcc -lcurl test.c -o test

并得到以下信息。

test.c: In function 'main':
test.c:4:2: error: unknown type name 'CURL'

libcurl 已安装在设备上。

Package libcurl (7.29.0-1) installed in root is up to date.

这是我运行 opkg files libcurl 时显示的内容

Package libcurl (7.29.0-1) is installed on root and has the following files:
/usr/lib/libcurl.so.4
/usr/lib/libcurl.so.4.3.0

最难找出问题所在。 This链接是我发现的唯一与我的问题相似的东西,但解决方案对我不起作用。有人有什么建议吗?

谢谢。

编辑: 所以我想我找到了有关该问题的更多信息。我想我也遗漏了很多 libcurl 开发包,因为我查看了 opkg.conf 文件,发现唯一的包列表如下。

http://downloads.arduino.cc/openwrtyun/1/packages

也许我需要找到一个包含我需要的额外 libcurl 包的 OpenWRT 包列表?不过我似乎找不到它们。

最佳答案

所以我能够解决我的问题,但我想不是“正确”。

显然,我正在运行的 OpenWRT 发行版使用了一个完全不同的 libcurl 库,当我尝试卸载它时,opkg 包管理器警告我,因为它too 也使用当前安装的 libcurl 库,如果我删除它可能会中断。

因此,我从 Github 手动安装了我需要的 libcurl 版本,然后在我的代码中进行了适当的引用以改用其他版本。

感谢大家帮助我找到正确的方向。

关于c - 错误 : unknown type name 'CURL' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31644452/

相关文章:

c - 如何使用 libcurl 打印远程 FTP 目录列表?

c - OpenGL VBO 仅在渲染时上传到 GPU

c - 如何将服务器绑定(bind)到不同的端口而不是单个端口?

php - 如何在 php 中使用 C modf 函数?

php - 使用 curl 获取 mysql 行

iphone - 通过卷页关闭 modalviewcontroller

c++ - libcurl - 无法找到过程入口点 CreateFile2

php - VC++ 2008 制作的 C++ EXE 可以在 Windows 7 上运行,但不能在 XP 上运行

url - curl (3) 和 "URL using bad/illegal format or missing URL"

c++ - 使用 libcurl 的线程安全代理