CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Feb 2005
    Posts
    64

    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

  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: Regarding Converting of an application to Unicode.

    use _T("A") instead of "A"

  3. #3
    Join Date
    Jun 2005
    Location
    Chennai , India
    Posts
    1,375

    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"
    It takes seconds for rating…that actually compensates the minutes taken for giving answers
    The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
    Regards, Be generous->Rate people
    Jayender!!

  4. #4
    Join Date
    Feb 2005
    Posts
    64

    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

  5. #5
    Join Date
    Jun 2005
    Location
    Chennai , India
    Posts
    1,375

    Thumbs up Re: Regarding Converting of an application to Unicode.

    Its better to do in Console Application to avoid this error.
    It takes seconds for rating…that actually compensates the minutes taken for giving answers
    The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
    Regards, Be generous->Rate people
    Jayender!!

  6. #6
    Join Date
    Dec 2005
    Posts
    642

    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".

    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);
    Last edited by googler; December 13th, 2005 at 07:55 AM.

  7. #7
    Join Date
    Jun 2005
    Location
    Chennai , India
    Posts
    1,375

    Thumbs up 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.
    It takes seconds for rating…that actually compensates the minutes taken for giving answers
    The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
    Regards, Be generous->Rate people
    Jayender!!

  8. #8
    Join Date
    Feb 2005
    Posts
    64

    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

  9. #9
    Join Date
    Dec 2005
    Posts
    642

    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.

  10. #10
    Join Date
    Feb 2005
    Posts
    64

    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
    Last edited by developerid; December 13th, 2005 at 08:11 AM.

  11. #11
    Join Date
    Jun 2005
    Location
    Chennai , India
    Posts
    1,375

    Thumbs up 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.
    It takes seconds for rating…that actually compensates the minutes taken for giving answers
    The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
    Regards, Be generous->Rate people
    Jayender!!

  12. #12
    Join Date
    Dec 2005
    Posts
    642

    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.

  13. #13
    Join Date
    Jun 2005
    Location
    Chennai , India
    Posts
    1,375

    Thumbs up Re: Regarding Converting of an application to Unicode.

    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
    It takes seconds for rating…that actually compensates the minutes taken for giving answers
    The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
    Regards, Be generous->Rate people
    Jayender!!

  14. #14
    Join Date
    Feb 2005
    Posts
    64

    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

  15. #15
    Join Date
    Feb 2005
    Posts
    64

    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...

Page 1 of 2 12 LastLast

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured