Results 1 to 3 of 3

Thread: WCHAR to QString giving error in vs2005

  1. #1
    ucomesdag Guest

    Post WCHAR to QString giving error in vs2005

    When using QString::fromWCharArray(const wchar_t* , int size = - 1);

    vs2005 gives the following error:
    Qt Code:
    1. error LNK2019: unresolved external symbol "__declspec(dllimport)
    2. public: static class QString __cdecl QString::fromWCharArray(wchar_t const *,int)"
    3. (__imp_?fromWCharArray@QString@@SA?AV1@PB_WH@Z) referenced in function "public:
    4. void __thiscall midiIO::queryMidiInDevices(void)" (?queryMidiInDevices@midiIO@@QAEXXZ)
    To copy to clipboard, switch view to plain text mode 

    To fix this, go to Project --> Properties --> Configuration Properties -->
    C/C++ --> Language, and set 'Treat wchar_t as Built-in Type' to No.

    Hope it helps someone, it fixed my day...

  2. The following 9 users say thank you to ucomesdag for this useful post:

    desch (16th November 2009), DIMEDROLL (12th December 2010), khaake (7th March 2007), McKee (11th May 2007), mclark (10th July 2008), negritot (30th September 2010), skuda (30th September 2010), soniaerm (29th April 2010), sunil.thaha (27th November 2006)

  3. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: WCHAR to QString giving error in vs2005

    Thanks for the info. Maybe you could add it to our wiki as well?

  4. #3
    Join Date
    May 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: WCHAR to QString giving error in vs2005

    I am a new Qt user. I am having this same issue on a project that I am currently on. I am linking into my Qt VS2005 project libraries that have the compiled with "Treat wchar_t as Built-in Type" set to "Yes". Third party libraries also appear to have been built this way. My Qt project file therefore sees unresolved externals when I call from the Qt project file into a libary. If, in my Qt project file I set the option to "No(/Zc:wchar_t-)" then my external libraries link just fine but Qt then has issues with the methods called by QString (such as ::fromStdWString() which then cannot link properly).

    How do I use Qt with libaries built with "Yes" for "Treat wchar_t as Built-in Type"?

    Steve

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.