Archived
This forum has been archived. Please start a new discussion on GitHub.
IceUtil::wstringToString link error?
Hi, I write the fallowing code in a dialog based application:
wstring wstr = ...;
string str = IceUtil::wstringToString(wstr);
...
But a link error occured and the compiler complains that the simbol can not be found.
When I move the same code to an console application, it passed easily.I don't know what's the reason?
wstring wstr = ...;
string str = IceUtil::wstringToString(wstr);
...
But a link error occured and the compiler complains that the simbol can not be found.
When I move the same code to an console application, it passed easily.I don't know what's the reason?
0
Comments
-
I use Depends check the IceUtil.dll and find that the simbol name the compiler look for is not the one exist in the lib
the symbol compiler look for:
?wstringToString@IceUtil@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@3@@Z
the symbol in the lib:
?wstringToString@IceUtil@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@3@@Z0 -
Hello,
Ice is built with Unicode enabled, and I suspect you're not linking with the Unicode libraries. For example if you're using MFC, you need to link with the 'U' MFC libraries:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_unicode_topics.asp
Cheers,
Bernard0 -
Hello, I examined the linkage information and be sure that I used the UNICODE version of MFC, but the wstringToString function STILL can not be find. I tried another function 'generateUUID' and it can be found successfully.
So I got fully puzzled
By the way, I even can't use Ice in a MFC project by just include <ice/ice.h>, so I include <winsock.h> before it to make sure some symbols, such as timeval, can be found. Does it bring out the mistake?0 -
This problem has been resolved!
Since ICE havn't taken wchar_t as original C++ type when generate the binary version for VC.Net, and for the MFC based project, wchar_t is taken as orininal type by default, if functions take wstring as parameters are used, this linkage error will occur.0