error LNK2019 : unresolved symbol error

coloradocolorado colorado leeOrganization: devnetworkProject: online scheduleMember
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 &)" ([email protected]@[email protected]@QAEXABV[email protected][email protected]@[email protected]@V[email protected]@[email protected]@Z),;该符号在函数 "public: void __thiscall CoachStation::BusAttendanceItem::__write(class IceInternal::BasicStream *)const " ([email protected]@[email protected]@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> > &)" ([email protected]@[email protected]@QAEXAAV[email protected][email protected]@[email protected]@V[email protected]@[email protected]@Z),;该符号在函数 "public: void __thiscall CoachStation::BusAttendanceItem::__read(class IceInternal::BasicStream *)" ([email protected]@[email protected]@Z) 中被引用

Any suggestion I appreciate.

Comments

  • coloradocolorado colorado leeOrganization: devnetworkProject: online scheduleMember
    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.
  • bernardbernard Jupiter, FLBernard NormierOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff
    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
  • coloradocolorado colorado leeOrganization: devnetworkProject: online scheduleMember
    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.
Sign In or Register to comment.