You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Wade <hy...@163.com> on 2006/09/08 04:40:40 UTC

How to execute the C++ sample?

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.


RE: How to execute the C++ sample?

Posted by nkiesel <nk...@tbdnetworks.com>.


tabish121 wrote:
> 
> 
> Have you tried running against the 4.0.2 Broker?
> 
> 

Good tip!  It works against the 4.0.2 broker.  Perhaps worthwile putting
that into the docu.

</nk>

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


Re: How to execute the C++ sample?

Posted by nkiesel <nk...@tbdnetworks.com>.
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 <hy...@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.


Re: How to execute the C++ sample?

Posted by Nathan Mittler <na...@gmail.com>.
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 <hy...@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.
>
>