Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] paho-dev Digest, Vol 46, Issue 18

Thanks Ian,

That was a perfect shot. MQTT C Samples are working, While i tried with C++, there were few problems. I meant i couldn't compile cpp samples. 

satish@zombie:~/works/mqtt/org.eclipse.paho.mqtt.cpp/src/samples$ make
g++ -I.. -I/home/satish/works/mqtt/org.eclipse.paho.mqtt.c/src -D_NDEBUG -Wall -std=c++0x -O2 -o async_publish async_publish.cpp -L../lib -L/home/satish/works/mqtt/org.eclipse.paho.mqtt.c/src/linux_ia64 -lmqttpp -lmqttv3a
/usr/bin/ld: cannot find -lmqttpp
/usr/bin/ld: cannot find -lmqttv3a
collect2: error: ld returned 1 exit status
Makefile:21: recipe for target 'async_publish' failed
make: *** [async_publish] Error 1

I couldn't find mqttpp or linux_ia64 folder in my machine. What would be the compile command for C++ samples?

When i tried to compile without trying to make in samples directory, i get a lot of undefined reference errors!

satish@zombie:~/works/mqtt/org.eclipse.paho.mqtt.cpp$ gcc src/samples/sync_publish.cpp -lpaho-mqtt3c -I src -lpthread  -std=c++11
/tmp/ccJXm2X5.o: In function `main':
sync_publish.cpp:(.text+0x174): undefined reference to `mqtt::client::client(std::string const&, std::string const&, mqtt::iclient_persistence*)



Thanks!

With Regards,

Satish V Madala Techpreneur & FOSS Evangelist


On Thu, Oct 15, 2015 at 9:30 PM, <paho-dev-request@xxxxxxxxxxx> wrote:
Send paho-dev mailing list submissions to
        paho-dev@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        https://dev.eclipse.org/mailman/listinfo/paho-dev
or, via email, send a message with subject or body 'help' to
        paho-dev-request@xxxxxxxxxxx

You can reach the person managing the list at
        paho-dev-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of paho-dev digest..."


Today's Topics:

   1. Re: Compiling Paho C Client (Ian Craggs)


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

Message: 1
Date: Thu, 15 Oct 2015 14:47:49 +0100
From: Ian Craggs <icraggs@xxxxxxxxxxxxxxxxxxxxxxx>
To: paho-dev@xxxxxxxxxxx
Subject: Re: [paho-dev] Compiling Paho C Client
Message-ID: <561FAE85.8000800@xxxxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"

Hi,

when you run the make file, it shows what commands are used to build the
libraries and samples:

cc -o build/output/samples/pubsync src/samples/pubsync.c -lpaho-mqtt3c
-I src -lpthread -L build/output

for pubsync.c for instance.  Your errors are caused by not linking to
the Paho library.


Ian

On 10/15/2015 04:12 AM, Satish V Madala wrote:
> Hi folks!
>
> I have been using MQTT since many days and for the first time i have
> to use a C/C++ Client. Probably, there is a compiling problem with the
> present code at paho git (or i miss something):
>
>
> git clonehttp://git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.c.git
> cd org.eclipse.paho.mqtt.c.git
> make
> make install
> Make Install was succesful and I have tried the sample in src/samples
> directory.
>
>     /gcc pubsync.c
>     ///tmp/ccbSD877.o: In function `main':
>     //pubsync.c:(.text+0xf2): undefined reference to `MQTTClient_create'
>     //pubsync.c:(.text+0x116): undefined reference to `MQTTClient_connect'
>     //pubsync.c:(.text+0x191): undefined reference to
>     `MQTTClient_publishMessage'
>     //pubsync.c:(.text+0x1d1): undefined reference to
>     `MQTTClient_waitForCompletion'
>     //pubsync.c:(.text+0x202): undefined reference to
>     `MQTTClient_disconnect'
>     //pubsync.c:(.text+0x211): undefined reference to `MQTTClient_destroy'
>     //collect2: error: ld returned 1 exit status/
>
> I got these errors. Any compilation document would be really helpful.
>
> Am running 15.04 Ubuntu. Was running mosquitto_clients and python
> clients on the machine.
> (Actually, I want C++ implementation, which would require this C
> Client installed. )
>
> It seems like libraries aren't linked, but isn't it supposed to be
> linked by default when i make installed?
>
> Thanks!
> With Regards,
>
> *Satish V Madala *| Techpreneur**& FOSS Evangelist
>
>
> _______________________________________________
> 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

--
Ian Craggs
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/paho-dev/attachments/20151015/dcd8282e/attachment.html>

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

_______________________________________________
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

End of paho-dev Digest, Vol 46, Issue 18
****************************************


Back to the top