Example MQTT Client Code not working C

前端 未结 1 1413
逝去的感伤
逝去的感伤 2021-01-21 22:20

I got the example code from here. I have the header file MQTTClient.h as well.

However when I build I get the errors:

undefined reference to M

相关标签:
1条回答
  • 2021-01-21 23:17

    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
    
    0 讨论(0)
提交回复
热议问题