You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by UnknownProgrammer <un...@excite.com> on 2008/03/11 17:45:09 UTC
Re: Unable to comile C++ client on VC++ 2003
Here is the possible fix for vc2003 professional ie MSC_VER 1310 but should
work for the express version also.
This is for activemq-cpp-2.1.3
vc2003 doesn't like virtual function returning different types.
all cloneDataStructure() const funtions in all
src\main\activemq\connector\openwire\commands files expact of course
DataStructure class returns the derived class* and not DataStructure*.
ie openwire\commands\TransactionInfo.h
virtual TransactionInfo* cloneDataStructure() const;
if you change cloneDataStructure return values to DataStructure*
so
virtual TransactionInfo* cloneDataStructure() const;
becomes
virtual DataStructure* cloneDataStructure() const;
I did a #ifdef check
ie.
virtual
#if defined _MSC_VER && _MSC_VER == 1310
DataStructure*
#else
TransactionInfo*
#endif
cloneDataStructure() const;
did same in each cpp file.
if defined _MSC_VER && _MSC_VER == 1310
DataStructure*
#else
TransactionInfo*
#endif
TransactionInfo::cloneDataStructure() const {
TransactionInfo* transactionInfo = new TransactionInfo();
// Copy the data from the base class or classes
transactionInfo->copyDataStructure( this );
return transactionInfo;
}
Once this is done you need to change
src/main/activemq/connector/openwire/OpenWireConnector.cpp
in every place it calls ->cloneDataStructure() you need to put it inside a
dynamic_cast<..>(...) of the type needed
ie. line 558
consumerInfo->setDestination( amqDestination->cloneDataStructure() );
becomes
#if defined _MSC_VER && _MSC_VER == 1310
consumerInfo->setDestination(
dynamic_cast<commands::ActiveMQDestination*>(amqDestination->cloneDataStructure())
);
#else
consumerInfo->setDestination( amqDestination->cloneDataStructure()
);
#endif
I have compiled this on linux(gcc 3.4), solaris(sunstudio 11) and now
windows XP vc2003.
I getting close to testing it on windows but haven't yet.
But it did compile. :jumping:
Hope this helps those that want to use vc2003.
U P :working:
David@BOBJ wrote:
>
> Hi,
>
> I tried to compile the C++ client on VC++ 2003. I had to change the
> version of VC++ in .sln and .vcproj to make it loaded by VC++ 2003. When I
> compiled it, I got quick a few errors. Example:
>
> TransactionInfo.cpp
> ..\src\main\activemq\connector\openwire\commands\TransactionInfo.h(77) :
> error C2511: 'activemq::connector::openwire::commands::DataStructure
> *activemq::connector::openwire::commands::TransactionInfo::cloneDataStructure(void)'
> : overloaded member function not found in
> 'activemq::connector::openwire::commands::TransactionInfo'
>
> ..\src\main\activemq\connector\openwire\commands\TransactionInfo.h(47) :
> see declaration of
> 'activemq::connector::openwire::commands::TransactionInfo'
> ..\src\main\activemq\connector\openwire\commands\TransactionInfo.h(77) :
> error C2511: 'activemq::connector::openwire::commands::DataStructure
> *activemq::connector::openwire::commands::TransactionInfo::cloneDataStructure(void)'
> : overloaded member function not found in
> 'activemq::connector::openwire::commands::TransactionInfo'
>
> ..\src\main\activemq\connector\openwire\commands\TransactionInfo.h(47) :
> see declaration of
> 'activemq::connector::openwire::commands::TransactionInfo'
>
> Does anyone knows how to fix it?
>
> I had tried different compile flags. But no luck.
>
> Thanks
>
> David
>
>
--
View this message in context: http://www.nabble.com/Unable-to-comile-C%2B%2B-client-on-VC%2B%2B-2003-tp14680479s2354p15978633.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.