Results 1 to 8 of 8

Thread: Finding window, linker error

  1. #1
    Join Date
    Nov 2007
    Posts
    51
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default Finding window, linker error

    Greetings.

    I used the following code with VS2003 and Qt 4.3.2 with success:

    Qt Code:
    1. HWND appWindow = FindWindow(NULL, static_cast<LPCWSTR>(title.toStdWString().c_str()));
    2. SetForegroundWindow(appWindow);
    To copy to clipboard, switch view to plain text mode 

    I now ported to VS2005 and Qt 4.4.0 and i receive the following linker error:

    error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall QString::toStdWString(void)const " (__imp_?toStdWString@QString@@QBE?AV?$basic_string @_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ XZ) referenced in function "private: void __thiscall test::nextWindow(void)" (?nextWindow@test@@AAEXXZ)

    Could you shed some light on what could be the problem?

    Thank you.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Finding window, linker error

    Looks like your Qt was compiled without STL support.
    J-P Nurmi

  3. #3
    Join Date
    Nov 2007
    Posts
    51
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default Re: Finding window, linker error

    Don't believe thats the case.

    Qt Code:
    1. std::string x = title.toStdString();
    To copy to clipboard, switch view to plain text mode 

    The above works just fine, but FindWindow needs a widestring param.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Finding window, linker error

    Can you find a "QString::toStdWString" symbol when you open up QtCore4.dll in Dependency Walker?
    J-P Nurmi

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Finding window, linker error

    Do you have something like "treat wchar as internal type" enabled in your project settings?
    J-P Nurmi

  6. #6
    Join Date
    Nov 2007
    Posts
    51
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default Re: Finding window, linker error

    Yes, i can find it in Dependency Walker and yes, Treat wchar_t as Built_in Type is set to Yes.

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Finding window, linker error

    What happens if you disable it?
    J-P Nurmi

  8. The following user says thank you to jpn for this useful post:

    Khal Drogo (14th March 2008)

  9. #8
    Join Date
    Nov 2007
    Posts
    51
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default Re: Finding window, linker error

    That seemed to do the trick. Thanks very much for helping me hunt this down.

Similar Threads

  1. Installation on Fedora Core 4
    By jcr in forum Installation and Deployment
    Replies: 3
    Last Post: 29th January 2009, 01:34
  2. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  3. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 02:49
  4. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52

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.