I download and install mosquitto-1.5.8.tar.gz on my orange pi, and I write a program to test it:
#include <stdio.h>
#include <mosquitto.h>
int main(void){
mosquitto_lib_init();
printf("OK\n");
mosquitto_lib_cleanup();
}
But when I try to compile it, I get this error:
`root@orangepilite:/# gcc test.c -o test
/tmp/ccMUyHdP.o: In function `main':
test.c:(.text+0x4): undefined reference to 'mosquitto_lib_init'
test.c:(.text+0x14): undefined reference to 'mosquitto_lib_cleanup'
collect2: error: ld returned 1 exit status`
Then I try this:
root@orangepilite:/# gcc test.c -o test -lmosquitto
/usr/bin/ld: warning: librt.so.0, needed by /usr/lib/gcc/arm-linux-
gnueabihf/5/../../../arm-linux-gnueabihf/libmosquitto.so, not found (try
using -rpath or -rpath-link)
/usr/bin/ld: warning: libc.so.0, needed by /usr/lib/gcc/arm-linux-
gnueabihf/5/../../../arm-linux-gnueabihf/libmosquitto.so, not found (try
using -rpath or -rpath-link)
/usr/lib/gcc/arm-linux-gnueabihf/5/../../../arm-linux-
gnueabihf/libmosquitto.so: undefined reference to `fcntl64'
collect2: error: ld returned 1 exit status
I'm new to mosquitto and linux, I really don't know what's the problem, wish someone could help me with it.
Here's the API link http://mosquitto.org/api/files/mosquitto-h.html, download here mosquitto.org/download