Results 1 to 4 of 4

Thread: error LNK2019 : unresolved symbol error

  1. #1
    colorado is offline Registered User
    Name: colorado lee
    Organization: devnetwork
    Project: online schedule
    Join Date
    Sep 2009
    Posts
    16

    error LNK2019 : unresolved symbol error

    I define BusAttendance.Ice, as follow:

    #ifndef BUS_ATTENDANCE_ICE
    #define BUS_ATTENDANCE_ICE

    module CoachStation
    {

    struct BusAttendanceItem
    {
    ["cpp:type:wstring"] string busNumber;
    ["cpp:type:wstring"] string departDatetime;
    ["cpp:type:wstring"] string actualBus;
    ["cpp:type:wstring"] string destination;
    bool isFlow;
    ["cpp:type:wstring"] string signedDatetime;
    };

    sequence<BusAttendanceItem> BusAttendanceSeq;

    interface BusAttendance
    {
    BusAttendanceSeq getBusAttendances(long now,int intervals);
    idempotent void sayHello(int delay);
    void shutdown();
    };

    };

    #endif

    When I remove all metadata directives: ["cpp:type:wstring"] , my application works fine,but when I add these directives, the VC+ 2008 SP1 compiler complains :

    1>BusAttendance.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall IceInternal::BasicStream::write(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (__imp_?write@BasicStream@IceInternal@@QAEXABV?$ba sic_string@GU?$char_traits@G@std@@V?$allocator@G@2 @@std@@@Z),该符号在函数 "public: void __thiscall CoachStation::BusAttendanceItem::__write(class IceInternal::BasicStream *)const " (?__write@BusAttendanceItem@CoachStation@@QBEXPAVB asicStream@IceInternal@@@Z) 中被引用
    1>BusAttendance.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall IceInternal::BasicStream::read(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > &)" (__imp_?read@BasicStream@IceInternal@@QAEXAAV?$bas ic_string@GU?$char_traits@G@std@@V?$allocator@G@2@ @std@@@Z),该符号在函数 "public: void __thiscall CoachStation::BusAttendanceItem::__read(class IceInternal::BasicStream *)" (?__read@BusAttendanceItem@CoachStation@@QAEXPAVBa sicStream@IceInternal@@@Z) 中被引用

    Any suggestion I appreciate.

  2. #2
    colorado is offline Registered User
    Name: colorado lee
    Organization: devnetwork
    Project: online schedule
    Join Date
    Sep 2009
    Posts
    16
    It seems wstring like string. When I transfer multibytes like East Asia characters, I can not use ascii string. but Ice transfer string using UTF-8.
    so, In server side, I convert my Qt string to std::string using QString::toStdString(), the result string is local encoding. I convert it with MutliBytesToWideChar,WideCharToMutliBytes,etc, so the final string encodes in UTF-8. Then in client, I receive the string correctly using C#'s string.

    With these steps, I need not wstring in BusAttendance.ice file.
    But, I still unknown what wrong with metadata directive.

  3. #3
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Colorado,

    I've just copied & pasted your Slice code in an Ice 3.4.1 demo--it built and linked fine with VS 2010.

    Are you using Ice 3.4.1? Can you try to the same experiment with one of the demos (and VS 2008 SP1)?

    If this linking error occurs only when using Qt as well, it could be a problem with this flag:
    /Zc:wchar_t (wchar_t Is Native Type)

    In this case you may want to rebuild Ice with /Zc:wchar_t-

    Cheers,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  4. #4
    colorado is offline Registered User
    Name: colorado lee
    Organization: devnetwork
    Project: online schedule
    Join Date
    Sep 2009
    Posts
    16
    Thanks Bernard, you give me an useful suggestion.

    Yes , I use Ice 3.4.1 , Qt 4.6.1, VC2008SP1 and XP Pro.
    As I find another way to make my project go on,I have not tested it.
    When I use it again , I will use your method.

    Thanks again.
    Last edited by colorado; 12-16-2010 at 07:02 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Linking Problems: Unresolved external symbol
    By Metadragonfire in forum Help Center
    Replies: 2
    Last Post: 06-26-2006, 08:16 PM
  2. Replies: 1
    Last Post: 02-05-2006, 01:58 AM
  3. Replies: 6
    Last Post: 04-11-2004, 09:12 PM
  4. Replies: 1
    Last Post: 11-07-2003, 07:56 AM
  5. Replies: 2
    Last Post: 09-03-2003, 02:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •