qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: compile qpid program with C++0X thread failed
Date Fri, 02 May 2014 11:35:19 GMT
On 05/02/2014 12:23 PM, An Yang wrote:
> Hi all,
>
> I'm using CentOS 6.5, and write a demo program with C++0x thread, it should
> create sender and receiver thread, but I got the followings:
> $g++ -std=c++0x -pthread qpid-thread.cpp  -o qpid-thread -lqpidmessaging
> qpid-thread.cpp: In function 'void qpid::tests::qpidReceive()':
> qpid-thread.cpp:27: error: no matching function for call to
> 'qpid::messaging::Receiver::fetch(qpid::messaging::Message&, int)'
> /usr/include/qpid/messaging/Receiver.h:78: note: candidates are: bool
> qpid::messaging::Receiver::fetch(qpid::messaging::Message&,
> qpid::messaging::Duration)
> /usr/include/qpid/messaging/Receiver.h:90: note:
> qpid::messaging::Message
> qpid::messaging::Receiver::fetch(qpid::messaging::Duration)

You need to pass a qpid::messaging::Duration object as the second 
parameter to fetch(), e.g.

> Connection connection;
> try {
>      connection = Connection("ampq:tcp:localhost");
>      connection.open();
>      Session session = connection.createSession();
>      Receiver receiver = session.createReceiver("benchmark");
>      receiver.setCapacity(1000);
>      Message msg;
>      if (receiver.fetch(msg, 0))
>          std::cout << "got a message" << std::endl;

   if (receiver.fetch(qpid::messaging::Duration::IMMEDIATE)


>      session.commit();
>      session.acknowledge();
>      session.close();
>      connection.close();
>      } catch(const std::exception& error) {
>          std::cerr << "qpid-receive: " << error.what() << std::endl;
>          connection.close();
>      }
> }
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message