Archived

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

Problem linking when migrating to Ice 3.3.1

:confused:

I got linking error when building my Ice-related project in VC 2003 using Ice 3.3.1 and here is one of the sample error

Linking...
Creating library ..\Lib\TRGTimeSeries-mt-1_0.lib and object ..\Lib\TRGTimeSeries-mt-1_0.exp
TRGIceStubs-mt.lib(dsl.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static void __cdecl IceInternal::LocalExceptionWrapper::throwWrapper(class exception const &)" (__imp_?throwWrapper@LocalExceptionWrapper@IceInternal@@Z)

If I switch it back to Ice-3.2.1. everything works fine. Any Idea?

Thx

c_cube

Comments

  • Have you cleaned your project? Most likely, a previously compiled object file is still lying around that wasn't recompiled after your upgrade. If that object file contains an external reference to a symbol in the Ice library that has changed, you get that kind of error.

    Make sure that you are starting with a clean slate by removing all previously-compiled object files, and things should work OK.

    Cheers,

    Michi.
  • Hi Michi,

    Thank you for taking the time responding to my post. Yes, I did clean all projects and did a rebuild all in VC 2003.

    One thing I notice is that IceInternal::LocalExceptionWrapper::throwWrapper is a method got added to Ice 3.3.1. I know that because I have compared the output of slice2cpp. I was able to compare all my ice file into cpp and header file and generated obj files and link them into a lib (let's call it icestubs.lib)

    The error stated in my original post occurs when other projects are trying to reference icestubs.lib in the linking process.

    How to confirm the method exists in ice.lib and iceutil.lib in my C:\Ice-3.3.1\lib folder? Thank you for your help again

    c_cube
  • Did you find a resolution to this? I am having the same problem. However I have only ever used ice 3.4.1
  • bernard
    bernard Jupiter, FL
    Hi Ronnie,

    Can you paste the error message you're getting, and also include information about your environment (Visual Studio version, debug or release, Win32/x64 target etc.)?

    Maybe we'll be able to spot the issue.

    All the best,
    Bernard
  • the error message I am receiving is:


    felixExample error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl IceInternal::LocalExceptionWrapper::throwWrapper(class exception const &)" (__imp_?throwWrapper@LocalExceptionWrapper@IceInternal@@Z) referenced in function __catch$?getDieselElement@DieselService@DieselServiceModule@service@pricing@aurora@rbccm@com@IceDelegateD@@UAE?AUDieselElement@234567@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00PBV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@2@@Z$0


    I am using this as my ice file:


    #ifndef AURORA_ICE
    #define AURORA_ICE

    //
    module com
    {
    module rbccm
    {
    module aurora
    {
    module pricing
    {
    module service
    {
    module DieselServiceModule
    {

    enum DieselErrorEnum { InstrumentNotFound, UserNotFound, InvalidUserDataFormat,
    UserDataObjectError, NotImplementedError, DieselServiceError, NoProxyError };

    exception BaseException {
    string reason;
    };

    exception DieselServiceException extends BaseException {
    DieselErrorEnum dieselError;
    };

    sequence<byte> SdObjectBytes;

    dictionary<string, string> DieselAttributeMap;

    struct DieselElement
    {
    string name;
    DieselAttributeMap attributeMap;
    };

    interface DieselService
    {
    DieselElement getDieselElement(string region, string cacheObjectId, string elementName) throws DieselServiceException;
    bool setDieselElement(string region, string cacheObjectId, DieselElement element) throws DieselServiceException;

    string getSdObjectXml(string region, string cacheObjectId) throws DieselServiceException;
    bool setSdObjectXml(string region, string cacheObjectId, string sdObjectXml) throws DieselServiceException;

    SdObjectBytes getDieselObject(string region, string cacheObjectId, string attribute) throws DieselServiceException;
    bool setDieselObject(string region, string cacheObjectId, SdObjectBytes sdObject) throws DieselServiceException;
    };
    };
    };
    };
    };
    };
    };
    //

    #endif

    and using slice2cpp.exe to generate the cpp code.

    I am running vs2003 on an xp box. I have also included both iced.lib and iceUtild.lib to the project settings.

    any ideas ?
  • bernard
    bernard Jupiter, FL
    Hi Ronnie,
    RonnieDay wrote: »

    I am running vs2003 on an xp box. I have also included both iced.lib and iceUtild.lib to the project settings.

    If that's not a typo, the issue is the version of Visual Studio you're using. With Ice 3.4.1, you need either Visual Studio 2008 or 2010 (for 2010, use lib and bin in the vc100 sub-directory).

    Best regards,
    Bernard
  • I wish it was a typo. I am dealing with legacy software. Is there anyway at all to use vs2003 ?
  • bernard
    bernard Jupiter, FL
    Hi Ronnie,

    You could use an old version of Ice with support for Visual Studio 2003:
    http://www.zeroc.com/download_3_2_1.html

    If you have other Ice components (clients, servers) without this old compiler requirement, I would recommend to use the latest Ice version for them. All versions of Ice inter-operate with each other.

    Cheers,
    Bernard