undefined reference to `nng_strerror'
Closed this issue · 2 comments
lobocv commented
Hi,
First of all, thank you for creating these bindings, I am excited to use them. I am having difficulties running your demo in the readme.
It seems like I am missing some sort of header / definition.
I have nanomsg installed and have nng/nng.h in my /usr/local/include.
A recursive grep shows that nng_strerror is in nng/nng.h
Calvin➜ include grep -rnw /usr/local/include -e "nng_strerror"
/usr/local/include/nng/nng.h:359:// nng_strerror returns a human readable string associated with the error
/usr/local/include/nng/nng.h:361:NNG_DECL const char *nng_strerror(int);
These are the only include you have in your demo but it seems to not compile.
#include <nngpp/nngpp.h>
#include <nngpp/protocol/req0.h>
#include <nngpp/protocol/rep0.h>
I have linked with libnanomsg as well but no luck.
cwzx commented
Undefined reference is a linker error.
You need to link with libnng using the following options.
- If you built nng without tls support:
-lnng -lpthread
- If you built nng with tls support:
-lnng -lmbedtls -lmbedx509 -lmbedcrypto -lpthread
I have added this info to the readme.
lobocv commented
Ah, I guess I had not linked with lnng,
Thank you, I'm up and running!