Regarding Converting of an application to Unicode.
Hi,
I am concerting an aaplication to UNicode.It is using STL and CAN NOT USE MFC.
what I did is , i declare
_UNICODE,UNICODE in projects->Settings->C/C++ tab->preprocessor settings
I declare
typedef basic_string<TCHAR> tstring in the file
and replace all the occurance with tstring.
Now the problem is:
for the statement
string strTemp[3]={"A","B","C"};
I replaced it with
tstring strTemp[3]={"A","B","C"};
it is giving me error at the compilation time.
error C2440: 'initializing' : cannot convert from 'char [4]' to 'class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >'
can u suggest some solution for this.
other than this,what function I can use in place of compare.
say for example, I am having 2 strings, and comparing like this
say
string str1;string str2;
str1.compare(str2).
when I replace this, with tstring like this
tstring str1;tstring str2;
str1.compare(str2).//now here it is giving error.
Pl. suggest some solution for these problems..
Once again I CAN NOT USE MFC.
Regs
Re: Regarding Converting of an application to Unicode.
use _T("A") instead of "A"
Re: Regarding Converting of an application to Unicode.
just check this link
convert an application to UNICODE
if a post helps, dont forget to "Rate this post"
Re: Regarding Converting of an application to Unicode.
Hi,
I am converting an application to UNICODE.This application is a dll.
I have defined the _UNICODE,UNICODE in to preprocessor definition.
Here I am MOT USING MFC.
It is using only STL functions.
Do I need to mention the "wWinMainCRTStartup" in to
Project->Settings->Link->Entry Point Symbol ???
If I am not defing this, it is compiling properly.
If I define this, it gives me the following
DebugU/RtfHtmlConverter.dll : warning LNK4086: entrypoint "_wWinMainCRTStartup" is not __stdcall with 12 bytes of arguments; image may not run
LIBCMTD.lib(wwincrt0.obj) : error LNK2001: unresolved external symbol _wWinMain@16
Cab u suggest some solution for this
Regs
Re: Regarding Converting of an application to Unicode.
Its better to do in Console Application to avoid this error.
Re: Regarding Converting of an application to Unicode.
Quote:
Originally Posted by developerid
Hi,
I am converting an application to UNICODE.This application is a dll.
I have defined the _UNICODE,UNICODE in to preprocessor definition.
This is not the correct way to do it. What you need to do is go to
Project Properties->Configuration Properties->General->Character Set
and change it to "Use Unicode Character Set".
Quote:
Do I need to mention the "wWinMainCRTStartup" in to
Project->Settings->Link->Entry Point Symbol ???
Not if you do it the way I mentioned above. That setting takes care of everything for you.
For a console app your main should be
Code:
int __cdecl _tmain(int argc, _TCHAR* argv[]);
For a Windows app your main should be
Code:
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow);
Re: Regarding Converting of an application to Unicode.
I think you didn't change the subsystem setting. In link tab in the bottom edit you will see a subsystem there you need to replace the windows with console.
Re: Regarding Converting of an application to Unicode.
I have entry point as
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_RTFHTMLCONVERTERLib);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
_Module.Term();
return TRUE;
}
what to change for this entry point??
Regs
Re: Regarding Converting of an application to Unicode.
Quote:
Originally Posted by developerid
I have entry point as
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
Sorry, forgot this was a DLL. Your main is fine. It doesn't take any string parameters so there is no _t version. However, change to Unicode like I said by using the General Settings. This will define the *UNICODE symbols for you and change to the correct entry point.
Re: Regarding Converting of an application to Unicode.
what I did is
I define the symbol _UNICODE and UNICODE in
Project->Settings->c/c++tab->General->Preprocessor definition
is this much is sufficient or some other else needs to be done...
Secondly I am not getting the path
Project Properties->Configuration Properties->General->Character Set.
where I will get this??
Regs
Re: Regarding Converting of an application to Unicode.
Check this one dude..
happen to come across this site
_WinMain@16 Unresolved External
see the messages that is there in the bottom.
hope this helps.
Re: Regarding Converting of an application to Unicode.
Quote:
Originally Posted by developerid
I changed subsystem to console, but the same error is there.
Secondly I ma not getting the path
Project Properties->Configuration Properties->General->Character Set.
where I will get this??
Regs
Vineet
My example is for VC++ 7.0 and above, while you appear to be using VC++ 6.0. I checked MSDN and it looks like VC++ 6.0 didn't have this option. So I guess you're stuck with defining the UNICODE, _UNICODE symbols manually. For the entry point, I suggest you leave it empty. For a DLL it should be using DllMainCRTStartup, and since there's no difference between MCBS & UNICODE DllMain, the entry point should be left the same.
Re: Regarding Converting of an application to Unicode.
Quote:
If you are using Unicode and MFC, you will get an unresolved external on _WinMain@16 if you don't create an entrypoint to wWinMainCRTStartup; use the /ENTRY.
Check this:
Linker Tools Error LNK2001
Re: Regarding Converting of an application to Unicode.
Hi Guys,
Thanks for your reply.I am using VC6.0.
SO I have done this a s per ur suggestion..
Once again Thanks for ur help and time devoted by u.
Regs
Re: Regarding Converting of an application to Unicode.
Hi,
There is a doubt regarding UNICODE conversion.
when I am converting an application to Unicode, do I need to replace BOOL, bool,int with something specific.. ??? or can they be as it is...
if yes, than what r they...