问题描述
我从获取示例代码。
我有头文件 MQTTClient.h
。
I got the example code from here.I have the header file MQTTClient.h
as well.
然而,当我建立我得到错误:
However when I build I get the errors:
未定义引用MQTTClient_create
未定义引用MQTTClient_connect
未定义引用MQTTClient_publishMessage
未定义引用MQTTClient_waitForCompletion
未定义引用MQTTClient_disconnect
在头文件中,这些设置如下:
In the header file these are set up as follows:
DLLExport int MQTTClient_create(MQTTClient* handle, const char* serverURI,
const char* clientId, int persistence_type, void* persistence_context);
我正在使用带有Eclipse C / C ++ IDE的Windows 8机器
I am using a Windows 8 machine with Eclipse C/C++ IDE
我也有一些paho-mqtt.dll我不知道如何获取示例代码并运行。
I also have some paho-mqtt.dll's I'm not sure how to get the example code up and running.
谢谢
Thank you
推荐答案
这意味着paho库没有链接。在Linux中为 c
程序示例,您可以通过以下方式链接paho库:
It means paho library is not linked. In Linux for a c
program example you can link paho library by this way:
gcc -L{complete path for output folder} {filename}.c -l paho-mqtt3c
在我的情况下,它看起来像:
In my case it looks like:
gcc -L/home/jaydev/MQTT/org.eclipse.paho.mqtt.c/build/output test2.c -lpaho-mqtt3c
这篇关于示例MQTT客户端代码不工作C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!