Hi
I have been using Ice with Python for some time with good results. I now need a C++ node. I'm no doubt doing something stupid but would appreciate it if someone could put me straight.
I'm using Eclipse on Ubuntu 8.04. This is a very simple test node with a test interface just so I can get some comms going from my Python node to C++ node.
Here is the Ice def:
Code:
#ifndef DISPLAYS_ICE
#define DISPLAYS_ICE
module AcornDisplays
{
interface Displays
{
void data(string display);
};
};
#endif
and here is the code.
Code:
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
#include "displays.h"
using namespace std;
using namespace AcornDisplays;
class DisplaysI : virtual public Displays {
public:
virtual void data(const string& s, const Ice::Current&);
};
void DisplaysI::data(const string& s, const Ice::Current&) {
cout << "Got some data!";
}
int main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
IceStorm::TopicManagerPrx topicManager;
Ice::ObjectPrx proxy;
Ice::ObjectAdapterPtr adapter;
IceStorm::TopicPrx topic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectPrx obj = ic->propertyToProxy("TopicManager.Proxy");
topicManager = IceStorm::TopicManagerPrx::checkedCast(obj);
adapter = ic->createObjectAdapter("Display.Subscriber");
DisplaysPtr display = new DisplaysI;
proxy = adapter->addWithUUID(display)->ice_oneway();
} catch (const Ice::Exception& e) {
cerr << e << endl;
status = 1;
}
try {
topic = topicManager->retrieve("Display");
IceStorm::QoS qos;
topic->subscribeAndGetPublisher(qos, proxy);
}
catch (const IceStorm::NoSuchTopic&) {
cout << "Error! No topic found!";
exit(1);
}
try {
adapter->activate();
} catch (const Ice::Exception& e) {
cerr << e << endl;
status = 1;
}
ic->waitForShutdown();
topic->unsubscribe(proxy);
return status;
}
I am linking with Ice, IceUtil and IceStorm. I am getting the following link errors which I don't understand.
Code:
/home/bob/dev/projects/acorn-sdr/ice/displays.h undefined reference to `vtable for AcornDisplays::Displays' displays
/home/bob/dev/projects/acorn-sdr/ice/displays.h undefined reference to `VTT for AcornDisplays::Displays' displays
/opt/Ice-3.3.0/include/Ice/Handle.h undefined reference to `IceInternal::upCast(AcornDisplays::Displays*)' displays
/opt/Ice-3.3.0/include/Ice/Handle.h undefined reference to `IceInternal::upCast(AcornDisplays::Displays*)' displays
Thanks
Bob