[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster-devel] Problem encountered when building C++ client

Hi Seamus,
sorry for having kept you waiting so long.
I tried your code with TAO and it works fine. I am lazy so I did the following:

I put strtest in $XMLBLASTER_HOME/demo/c++ and then
went to line 1918 of build.xml and added strtest to the list of the demos like this:

<foreach list="HelloWorld2,PublishDemo,SubscribeDemo,ExternOrb,strtest"

I called

build.sh cpp -v

(the -v flag shows the command line).

for TAO it was the following (for the compilation part just add the includes stuff)

gcc -Wl,-rpath=/home/michele/software/ACE_wrappers/TAO/../ace -Wl,-rpath=/usr/local/xerces-c/lib -Wl,-rpath=/home/michele/xmlBlaster_main/lib -g -o PublishDemo ../../../build/objCPP/PublishDemo.o -L/home/michele/software/ACE_wrappers/ace -lACE -L/home/michele/software/ACE_wrappers/TAO/tao -lTAO -L/home/michele/software/ACE_wrappers/TAO/tao/PortableServer -lTAO_PortableServer -L/home/michele/software/ACE_wrappers/TAO/orbsvcs/orbsvcs -lTAO_CosNaming -L/usr/local/xerces-c/lib -lxerces-c -L/home/michele/xmlBlaster_main/lib -lxmlBlasterClient -L/lib -ldl -L/usr/lib -lpthread


Seamus Huang wrote:
Hi all,

I have written a fairly simple C++ client, but I am having problem to
build it.  Here's what I wrote (in one file named "strtest.cpp"):

#include <string> #include <iostream> #include <client/XmlBlasterAccess.h> #include <client/xmlBlasterClient.h> #include <util/Global.h>

using namespace std;
using namespace org::xmlBlaster::util;
using namespace org::xmlBlaster::client;
using namespace org::xmlBlaster::client::qos;
using namespace org::xmlBlaster::client::key;

class MessageClient : public I_Callback

        virtual ~MessageClient()

        virtual string update(const string& sessionId_, UpdateKey&
updateKey_, void *content_, long contentSize_, UpdateQos& updateQos_)
            string content((char*)content_);
//             return "";
            return processMessage(updateKey_.getOid(), content);

        virtual string processMessage(const string& topic_, const
string& content_)
            string rc = "hello world";

            cout << "\n";
            cout << "Topic = " << topic_;
            cout << "Content = " << content_;
            return rc;

}; // class MessageClient

int main (int args, char** argv) { // XMLPlatformUtils::Initialize(); // Global& glob = Global::getInstance(); // glob.initialize(args, argv); MessageClient client; return 0; }

I understand that the code is non-functional, but it should still be
able to compile and link.  If I use the following command to compile and
link it (in one step):

g++  -g -Wall -D_REENTRANT -DMICO  -I/home/emx/mico/include
-I/home/emx/xmlBlaster/src/c++ -I. -L/home/emx/xerces-c-src_2_3_0/lib
-L/home/emx/xmlBlaster/lib -L/home/emx/mico/lib  -lpthread -lmico2.3.7
-ldl -lxerces-c -lxmlBlasterClient -lmicocoss2.3.7 -ostrtest strtest.cpp

Then I got this error:

/tmp/cc0WEbf6.o: In function
`MessageClient::update(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, org::xmlBlaster::client::key::UpdateKey&,
void*, long, org::xmlBlaster::client::qos::UpdateQos&)':
/home/emx/xmlBlaster/src/c++/util/ErrorCode.h:62: undefined reference to
`org::xmlBlaster::client::key::MsgKeyBase::getOid() const'
collect2: ld returned 1 exit status

If I comment out the call to processMessage() in update() and replace it with the return of empty string, then the code will build without any problem.

I have already checked the following environment variables, they all exist and correct: MICO_HOME=/home/emx/mico XERCESCROOT=/home/emx/xerces-c-src_2_3_0 XMLBLASTER_HOME=/home/emx/xmlBlaster

Also, I have checked that the library files exist and at the correct
directories as well:
/home/emx/xerces-c-src_2_3_0/libxerces-c.so	(symbolic link)
/home/emx/xerces-c-src_2_3_0/libxerces-c.so.23	(symbolic link)

Is there anything I missed?

Thanks in advance.

Seamus Huang

Michele Laghi
mailto:laghi at swissinfo.org
tel. +46 8 7492952 / mob. +46 70 4103964