Tango DeviceProxy error:

When I write a simple program for accessing a device proxy in Cpp, like #include <tango.h>

#include <DeviceProxy.h>

using namespace Tango;
int main(unsigned int argc, char **argv)
// try
// {

// create a connection to a TANGO device

DeviceProxy *device = new DeviceProxy("ttyS0/port/1");

// Ping the device


ease: " << spr << endl;
// }
// catch (DevFailed &e)
// {
// Except::print_exception(e);
// exit(-1);
// }

When I compile it with command
$ g++ client.cpp -o first

It gives following error

client.cpp:(.text+0x2f): undefined reference to `Tango::DeviceProxy::DeviceProxy(char const*, CORBA::ORB*)'
/tmp/ccDn8erO.o: In function `__static_initialization_and_destruction_0(int, int)':
client.cpp:(.text+0xa4): undefined reference to `omni_thread::init_t::init_t()'
client.cpp:(.text+0xb9): undefined reference to `omni_thread::init_t::~init_t()'
client.cpp:(.text+0xcd): undefined reference to `_omniFinalCleanup::_omniFinalCleanup()'
client.cpp:(.text+0xe2): undefined reference to `_omniFinalCleanup::~_omniFinalCleanup()'
collect2: error: ld returned 1 exit status

Please any bode help me to remove out this error
Hi Bublee,

it looks like your executable does not find the shared libraries. Can you do:

ldd first

It should show you if you have the correct libraries and your LD_LIBRARY_PATH is correctly setup. Which platform on you on and how did you install Tango?


You should

include <tango.h>

instead of
#include <DeviceProxy.h>

You should also link with all the following libraries:
-ltango -lzmq -lomniORB4 -lomnithread -lCOS4 -lomniDynamic4

Do not forget to add something like:

-L<tango_home>/lib to also give the path where gcc will look for the libraries

Hoping this helps

Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Register or login to create to post a reply.