News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Paho MQTT-C API

Started by sylvanomtl, June 05, 2020, 09:53:38 PM

Previous topic - Next topic

sylvanomtl

HI there,
I am quite new to CodeBlock and I have refreshed myself using C/C++ language (I am more a Matlab guy).
I am interested in using the MQTT API from Paho: https://www.eclipse.org/paho/clients/c/#

I am using one of the example given in the examples of the API : https://www.eclipse.org/paho/files/mqttdoc/MQTTClient/html/subasync.html

I understand there is a .lib folder I need to integrate to my project. I added it using : Project > Build Option > Linker Settings > Add... 


Do you know how can I link to the folder containing the headers files?  "MQTTClient.h" ?

BlueHazzard

 First you have to build the library, and install it.
Then you probably get something like

installDir:
|- bin
|- lib
|   |- somelibraryname.a
| - include
     |- someheader.h


To use this library in your codeblocks project you do the following:
1) Setup the project build options:
1.1) Project->Build options->Select your project name on the left
1.2) Search directories-> Compiler
1.3) Add the include directory for the library
1.4) Search directories->Linker
1.5) Add the lib folder for the library
1.6) Linker settings->Add - the .lib file you can only the name, because you have added the folder to the search directories...

now you should be able to use it in your project.
If you have problems:
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F