Archived

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

Getting started

I've downloaded and installed Ice-3.4.2 and created the demo programs in Python 2.6. These work perfectly. I then built the C++ sample from the manual using Visual Studio 2010 running under Windows 7 (64-bit) and tried to run that. I've got two problems:
  1. The line below gives me an access violation. Moving the value to a temporary fixes the issue (I'm using the debug heap):
    adapter->add(object, ic->stringToIdentity("SimplePrinter"));
    
  2. After fixing the above I can then start the server and client, but I get an OperationNotExistException in the generated Printer.cpp file:
    ::Ice::DispatchStatus
    Demo::Printer::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)
    {
        ::std::pair< ::std::string*, ::std::string*> r = ::std::equal_range(__Demo__Printer_all, __Demo__Printer_all + 5, current.operation);
        if(r.first == r.second)
        {
            throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
        }
    
    The current operation appears to be an empty string, and it is failing on the client's checked cast. The same thing happens if I try connecting the Python client to the C++ server.
I'm building a 32-bit application, linking against the 32-lib libraries in the "vc100" subfolder (the main folder gives the same result).

Has anyone had a similar problem, or know what the solution is?

Comments

  • mes
    mes California
    Iain,

    Welcome to the forum.

    Are you sure you're linking with the debug version of the Ice libraries? See this FAQ for more information.

    Cheers,
    Mark
  • Thanks Mark - that was the problem. I've now got what looks like a VC runtime mismatch, but should be able to sort that out this evening.

    Thanks again for the quick reply.
  • I've got the demo working. For the benefit of anyone else with the same issue:
    • match the version of the Visual Studio runtime brought in via ZeroC libs with your VS version (use dependency walker if need be to check). VS 2010 libs are in "vc100" subfolder of lib.
    • this extends to DLLs - check which you are loading at runtime from the path - make sure that you've got the "ice-3.4.2/bin/vc100" folder rather than "ice-3.4.2/bin" if you're using VS 2010.

    This is definitely a VS problem rather than a ZeroC issue, but it might be helpful to put a note about VS runtime versions in the C++ demo section of the manual to help any other similarly clueless people?
  • mes
    mes California
    Hi Iain,

    We do describe how to configure your environment in the Using the Windows Binary Distribution of the release notes.

    Glad to hear the demo's working for you now.

    Take care,
    Mark
  • Ah, my fault for not reading it properly. Thanks for your help!
  • Hey!

    I'm having the same issue. I'm using a C++ Client (VS2012) with a C++ Server (VS2013). I DISABLED the Ice Builder in Visual Studio. That means I generated .h and .cpp files manually with the slice2cpp lying in C:\Program Files (x86)\ZeroC\Ice-3.5.1\bin and added them to the Client and Server-VS-Projects. Is it ok to generate the files for Client and Server with the same slice2cpp or do I have to use the specific slice2cpp in the subfolder (if this is the case which one exactly? x64 or vc110 or vc120)? But the generated .h and .cpp doesn't look VS-dependent.. So I thought this is not necessary.

    If I want to use the Path-Variable (instead of copying the files in the exe-Dir) - how do I have to set it if I use both - VS2012 and VS2013?

    Cheers,
    Johanna
  • bernard
    bernard Jupiter, FL
    Hi Johanna,

    slice2cpp for a given version of Ice always generates the same code, on all platforms. You could for example run slice2cpp on Linux or OS X and use the resulting code on Windows - so it's of course fine to use the slice2cpp from the main "bin" directory in the Windows distribution.
    do I have to use the specific slice2cpp in the subfolder (if this is the case which one exactly? x64 or vc110 or vc120)?

    You can use any of them. In the latest release (3.6.1), we install only one slice2cpp.exe, in the main bin directory.

    If I want to use the Path-Variable (instead of copying the files in the exe-Dir) - how do I have to set it if I use both - VS2012 and VS2013?

    Since the Ice DLLs have the same names with VS2012 and VS2013, you have two options:
    - copy the DLLs next to the .exes
    or
    - use a different PATH environment for your VS2012 and VS2013 programs

    Best regards,
    Bernard