Author Topic: Paho MQTT-C API  (Read 194 times)

Offline sylvanomtl

  • Single posting newcomer
  • *
  • Posts: 1
« on: June 05, 2020, 09:53:38 pm »
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:

I am using one of the example given in the examples of the API :

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" ?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2765
« Reply #1 on: June 07, 2020, 02:11:44 pm »
 First you have to build the library, and install it.
Then you probably get something like
Code: [Select]
 |- 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: