Archived

This forum has been archived. Please start a new discussion on GitHub.

I can compile from ther client side but not the server

I'm using GCC 4.7.2 on Fedora 18 with IceGrid (Sorry for the long post, but I'm really stuck). And I can compile this code on the client side:
try
{
    player = PlayerPrx::checkedCast(communicator()->stringToProxy("player"));
}
catch(const Ice::NotRegisteredException&)
{
    IceGrid::QueryPrx query = IceGrid::QueryPrx::checkedCast(communicator()->stringToProxy("IceGrid/Query"));
    player = PlayerPrx::checkedCast(query->findObjectByType("::NetworkICE::Player"));
}
if(!player)
{
    cerr << argv[0] << ": couldn't find a `::NetworkICE::Player' object." << endl;
    return EXIT_FAILURE;
}

But on the server side I cant compile this:
try
{
    locator = PlayerLocatorPrx::checkedCast(communicator()->stringToProxy("PlayerLocator"));
}
catch(const Ice::NotRegisteredException&)
{
    IceGrid::QueryPrx query = IceGrid::QueryPrx::checkedCast(communicator()->stringToProxy("IceGrid/Query"));
    locator = PlayerLocatorPrx::checkedCast(query->findObjectByType("::NetworkICE::PlayerLocator"));
}
if(!locator)
{
    cerr << argv[0] << ": couldn't find a `::NetworkICE::PlayerLocator' object." << endl;
    return EXIT_FAILURE;
}

Ice::PropertiesPtr properties = communicator()->getProperties();
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PlayerAdapter");
Ice::Identity id = communicator()->stringToIdentity(properties->getProperty("Identity"));
PlayerPtr player = new PlayerI();
adapter->add(player, id);
adapter->activate();
communicator()->waitForShutdown();

I get this error from GCC on the catch
main.cpp|| undefined reference to `IceProxy::IceGrid::Query::findObjectByType(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const*)'|

I'm really don't understand why this isn't compiling for the server side since its the basic same steps from the client side. I need that the server acts like a client getting information on another server called PlayerLocator that will store on which server every Player is connected on the grid.

The include files are the same for client and server. <Ice/Ice.h> and <IceGrid/IceGrid.h>

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Could copy/paste the full error message? It's not clear whether or not it's a linker or compiler error here. If you included IceGrid/IceGrid.h, I guess this is a linker error. Perhaps you forgot to add the -lIceGrid linker option to your linker options?

    Cheers,
    Benoit.
  • It was that, thank you a lot Benoit. Its weird that it was compiling before when the server doesn't acted like a client. And the client is compiling without -lIceGrid.

    Thank you again.