How to compile using libmosquitto

前端 未结 1 1186
臣服心动
臣服心动 2021-01-19 23:07

Iam trying to compile the code example available on the libmosquitto website (at the bottom): http://mosquitto.org/man/libmosquitto-3.html

Iam using Ubuntu 12.04 and

相关标签:
1条回答
  • 2021-01-19 23:45

    You have to put the -lmosquitto at the end (after the source files).

    gcc mosquito.c -lmosquitto -o mosquito
    # or
    gcc mosquito.c -o mosquito -lmosquitto
    # or
    gcc -o mosquito mosquito.c -lmosquitto
    

    Or better:

    gcc -Wall -Wextra -pedantic -o mosquito mosquito.c -lmosquitto
    
    0 讨论(0)
提交回复
热议问题