activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkiesel <nkie...@tbdnetworks.com>
Subject Re: How to execute the C++ sample?
Date Mon, 11 Sep 2006 05:54:58 GMT

I tried to use it under Linux (with glibc 2.3.6 => NPTL threads).  Compile
went fine using the makefile ("make OSTYPE=linux CONFIG=debug all") after I
installed libuuid and libcppunit (for Debian/Ubuntu: "sudo apt-get install
uuid-dev libcppunit-dev").

However, I do have problems with the supplied example:
1) it does not compile because itoa is missing under Linux and main must
return int.  I fixed that using the following patch:

Index: main.cpp
===================================================================
--- main.cpp    (revision 442107)
+++ main.cpp    (working copy)
@@ -77,7 +77,7 @@

             // Stringify the thread id
             char threadIdStr[100];
-            itoa( Thread::getId(), threadIdStr, 10 );
+            sprintf( threadIdStr, "%d", Thread::getId() );

             // Create a messages
             string text = (string)"Hello world! from thread " +
threadIdStr;
@@ -239,7 +239,7 @@
     }
 };

-void main(int argc, char* argv[]) {
+int main(int argc, char* argv[]) {

     HelloWorldProducer producer( 1000 );
        HelloWorldConsumer consumer( 5000 );
@@ -255,6 +255,7 @@
        // Wait for the threads to complete.
        producerThread.join();
        consumerThread.join();
+       return 0;
 }

 // END SNIPPET: demo


Then I compiled and linked using "g++ -o main -pthread -I ../main main.cpp
../../out/libactivemq-cpp-0_0_2.a -luuid"

2) Running main against the standard AQ 4.0.1 broker (started using "sh
bin/activemq") gives error messages:
ResponseCorrelator::onCommand() - received unknown response for request: 0
ResponseCorrelator::onCommand() - received unknown response for request: 0
response from futureResponse was invalid - tid: 3085962160
        FILE: src/main/activemq/transport/ResponseCorrelator.h, LINE: 223 -
tid: 3085962160
        FILE: src/main/activemq/transport/ResponseCorrelator.h, LINE: 230 -
tid: 3085962160
        FILE: src/main/activemq/connector/stomp/StompConnector.cpp, LINE:
266 - tid: 3085962160
        FILE: src/main/activemq/connector/stomp/StompConnector.cpp, LINE:
165 - tid: 3085962160
        FILE: src/main/activemq/core/ActiveMQConnectionFactory.cpp, LINE:
179 - tid: 3085962160
response from futureResponse was invalid - tid: 3077569456
        FILE: src/main/activemq/transport/ResponseCorrelator.h, LINE: 223 -
tid: 3077569456
        FILE: src/main/activemq/transport/ResponseCorrelator.h, LINE: 230 -
tid: 3077569456
        FILE: src/main/activemq/connector/stomp/StompConnector.cpp, LINE:
266 - tid: 3077569456
        FILE: src/main/activemq/connector/stomp/StompConnector.cpp, LINE:
165 - tid: 3077569456
        FILE: src/main/activemq/core/ActiveMQConnectionFactory.cpp, LINE:
179 - tid: 3077569456

I did not solve this problem yet. Any ideas what's going wrong?


I just need to send simple text messages from a C++ program to a Java client
using a single queue, so using openwire-c from C++ would also be an option.
However, it seems that code is in bad shape: no makefiles, #include missing,
and does not compile.

Best,
  Norbert



nmittler wrote:
> 
> We've recently moved some of the source around in subversion, so it may
> have
> happened that you grabbed the source at the wrong time.  You can get the
> code from it's new location here:
> https://svn.apache.org/repos/asf/incubator/activemq/activemq-cpp/trunk/activemq-cpp/.
> 
> 
> Also, Thread.h and Runnable.h are both in the concurrent package under
> https://svn.apache.org/repos/asf/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/
> 
> Regards,
> Nate
> 
> On 9/7/06, Wade <hyfyk@163.com> wrote:
>>
>>
>> hi,
>>    I was trying to run the cpp client code given on
>> http://www.activemq.org/site/activemq-cpp-client.html
>>
>>
>>   I cant get the cpp client to complie by VC++6.0
>>
>> the error message is : annot open include file: 'activemq/Thread.h': No
>> such
>> file or directory
>> where i can find the file Thread.h and Runnable.h
>>
>> Please guide me.
>> Thanks
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-execute-the-C%2B%2B-sample--tf2236754.html#a6202005
>> Sent from the ActiveMQ - User forum at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-execute-the-C%2B%2B-sample--tf2236754.html#a6241426
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message