Paho CPP - compile as a static executable

235 Views Asked by At

Is it possible to compile Paho CPP as a static executable? If so - how?

Here is an example of the compilation statement for one of the examples:

g++ -DOPENSSL -I.. -I/usr/local/include -D_NDEBUG -Wall -std=c++11 -O2 -o data_publish data_publish.cpp -L../../lib -L/usr/local/lib -lpaho-mqttpp3 -lpaho-mqtt3a

How do I compile this as a static executable?

1

There are 1 best solutions below

0
Maxim Egorushkin On

Build Paho with static libraries.

And then link it with -static command line switch. E.g. g++ ... -static -lpaho-mqttpp3 -lpaho-mqtt3a.