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:
Code:
HWND appWindow = FindWindow(NULL, static_cast<LPCWSTR>(title.toStdWString().c_str()));
The above code worked beautifully under VS2003, but it gives the following linking error under VC2005. :
Quote:
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.
Re: Problem porting to VC2005
Is this another Qt installation too? Looks like your Qt was built without STL support.
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.
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?
Re: Problem porting to VC2005
It means, i opened the solution file and let VS convert my project.
Re: Problem porting to VC2005
What if you create a proper .pro file and let qmake generate a Visual Studio project for you?
Re: Problem porting to VC2005
Or do a clean rebuild instead 'just opening and compiling'
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?
Re: Problem porting to VC2005
The solution found in the other thread:
Project-Property
wchar_t as Built_in Type -> set to False.
Re: Problem porting to VC2005
Code:
HWND appWindow = FindWindow(NULL, static_cast<LPCWSTR>(title.toStdWString().c_str()));
you can replace this with
Code:
HWND appWindow = FindWindow(NULL, (wchar_t*)title.utf16());