Results 1 to 10 of 10

Thread: Problem porting to VC2005

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

    Default Problem porting to VC2005

    Greetings.

    I had a project made under VC2003 with Qt 4.3.3, and i tried to port it to VC2005.

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

    The above code worked beautifully under VS2003, but it gives the following linking error under VC2005. :
    Error 1 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) test.obj
    Please give me some ideas as to why this might happen.

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

    Default Re: Problem porting to VC2005

    Is this another Qt installation too? Looks like your Qt was built without STL support.
    J-P Nurmi

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

    Default Re: Problem porting to VC2005

    That was my first idea, but it isn't so, title.toStdString() works perfectly, but i cannot convert it to whatever FindWindow needs.

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

    Default Re: Problem porting to VC2005

    So, what does "porting from vs2003 to vs2005" mean in this case? Did you simply open the old .vcproj in vs2005 or have you maintained a .pro file?
    J-P Nurmi

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

    Default Re: Problem porting to VC2005

    It means, i opened the solution file and let VS convert my project.

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

    Default Re: Problem porting to VC2005

    What if you create a proper .pro file and let qmake generate a Visual Studio project for you?
    J-P Nurmi

  7. #7
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 86 Times in 81 Posts

    Default Re: Problem porting to VC2005

    Or do a clean rebuild instead 'just opening and compiling'

  8. #8
    Join Date
    Sep 2006
    Posts
    20
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem porting to VC2005

    Hi! I have the same problem with QString::toStdWString().
    My project is originally VS2005-QT4.2 Project. I have had no Problem wether with STL nore with QT, before I tried toStdWString(). Clean/Rebuild/reimport from PRO does not help. Any constructiv idea?

  9. #9
    Join Date
    Sep 2006
    Posts
    20
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem porting to VC2005

    The solution found in the other thread:
    Project-Property
    wchar_t as Built_in Type -> set to False.

  10. #10
    Join Date
    Jan 2008
    Location
    Russia, Chelyabinsk
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem porting to VC2005

    Qt Code:
    1. HWND appWindow = FindWindow(NULL, static_cast<LPCWSTR>(title.toStdWString().c_str()));
    To copy to clipboard, switch view to plain text mode 
    you can replace this with
    Qt Code:
    1. HWND appWindow = FindWindow(NULL, (wchar_t*)title.utf16());
    To copy to clipboard, switch view to plain text mode 
    So you can code punk?

Similar Threads

  1. Weird problem while porting from Qt3 to Qt4
    By vermarajeev in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 07:51
  2. Font Problem Porting from Windows to Linux
    By rajeshs in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2007, 10:25
  3. Problem related to porting from QT3 to QT4 in list items
    By rohitjun in forum Qt Programming
    Replies: 5
    Last Post: 1st June 2007, 09:05
  4. Problem porting Kivio MP on win32 from Qt 3 to Qt 4
    By Amanda in forum Qt Programming
    Replies: 2
    Last Post: 26th October 2006, 19:40
  5. Problem in porting Main window on linux
    By jyoti kumar in forum Qt Tools
    Replies: 2
    Last Post: 2nd June 2006, 08:35

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
  •  
Qt is a trademark of The Qt Company.