Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Compiling C++ client

Hey Roger,

I'll upload a fix when I get a minute, but it seems that the C API changed (for the better) and broke the C++ wrapper.

The clientID and serverURI parameters of iclient_persistence::persistence_open() should now be "const char*" instead of "char*"

Frank

------------

diff --git a/src/iclient_persistence.cpp b/src/iclient_persistence.cpp
index 755c561..32f617e 100644
--- a/src/iclient_persistence.cpp
+++ b/src/iclient_persistence.cpp
@@ -70,8 +70,8 @@ public:
 // C++ persistence object, which is reassigned to the 'handle'. Subsequent
 // calls have the object address as the handle.
 
-int iclient_persistence::persistence_open(void** handle, char* clientID,
-                                                                                 char* serverURI, void* context)
+int iclient_persistence::persistence_open(void** handle, const char* clientID,
+                                                                                 const char* serverURI, void* context)
 {
        try {
                if (context) {
diff --git a/src/mqtt/iclient_persistence.h b/src/mqtt/iclient_persistence.h
index 1fad4df..f44dd9a 100644
--- a/src/mqtt/iclient_persistence.h
+++ b/src/mqtt/iclient_persistence.h
@@ -61,7 +61,7 @@ class iclient_persistence
 public:
 
        /** C-callbacks  */
-       static int persistence_open(void** handle, char* clientID, char* serverURI, void* context);
+       static int persistence_open(void** handle, const char* clientID, const char* serverURI, void* context);
        static int persistence_close(void* handle);
        static int persistence_put(void* handle, char* key, int bufcount, char* buffers[], int buflens[]);
        static int persistence_get(void* handle, char* key, char** buffer, int* buflen);


On 05/18/2015 05:46 PM, Roger Light wrote:
Hi Frank,

Linux and g++ 4.6, 4.9 and 5.0.

Cheers,

Roger


On Mon, May 18, 2015 at 7:29 PM, Frank Pagliughi <fpagliughi@xxxxxxxxxxxxxx> wrote:
I'll have a look. I've been sitting on an update for a while now, and haven't checked the current code against the latest C library (which it wraps).

What host / OS / compiler / version(s) are you trying this with?

Frank


On 05/18/2015 02:23 PM, Roger Light wrote:
Hi,

I'm having problems compiling the C++ library, can anybody assist?

I've done:

export PAHO_C_LIB=<path to Paho C repo>
cd src
make -f ../Makefile

The error I get is:

async_client.cpp: In constructor ‘mqtt::async_client::async_client(const string&, const string&, mqtt::iclient_persistence*)’:
async_client.cpp:76:3: error: could not convert ‘{persistence, mqtt::iclient_persistence::persistence_open, mqtt::iclient_persistence::persistence_close, mqtt::iclient_persistence::persistence_put, mqtt::iclient_persistence::persistence_get, mqtt::iclient_persistence::persistence_remove, mqtt::iclient_persistence::persistence_keys, mqtt::iclient_persistence::persistence_clear, mqtt::iclient_persistence::persistence_containskey}’ from ‘<brace-enclosed initializer list>’ to ‘MQTTClient_persistence’
   };
   ^
make: *** [obj/async_client.o] Error 1

Cheers,

Roger



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev


Back to the top