Qt调用MFC的dll或者lib出错

Qt调用MFC的dll或者lib出错

需要把以前用MFC写的工程移植到Qt上,工程比较大,就暂且先移植界面部分,dll库和lib库暂时不移植。
用VS2005创建Qt工程,工程 本身能够写一些包含MFC特性的东西(如CString),在调用dll库或者lib库时,调用一般类型的函数返回值(int型)可以成功,但如果其中的 函数有CString或者std::wstring类型的返回值时,编译不能通过。链接出错信息如下:
Linking...
qt_app.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > __thiscall LibAdd::GetString(void)" (?GetString@LibAdd@@QAE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@XZ) referenced in function "private: void __thiscall Qt_App::OnOKButton(void)" (?OnOKButton@Qt_App@@AAEXXZ)

qt_app.obj : error LNK2019: unresolved external symbol "public: class ATL::CStringT<unsigned short,class StrTraitMFC_DLL<unsigned short,class ATL::ChTraitsCRT<unsigned short> > > __thiscall LibAdd::GetCString(void)" (?GetCString@LibAdd@@QAE?AV?$CStringT@GV?$StrTraitMFC_DLL@GV?$ChTraitsCRT@G@ATL@@@@@ATL@@XZ) referenced in function "private: void __thiscall Qt_App::OnOKButton(void)" (?OnOKButton@Qt_App@@AAEXXZ)

也听说Qt官方公布了一个移植框架Qt Winmigrate,但这个框架还只能在win32平台跑,工程需要在win32和wince平台运行,没法用。

还尝试过用QTCreater创建工程,在pro文件中添加 LIBS += D:\WorkPlace\QtWin32\Win32_Lib2.lib,出错信息一样。

没辙了,请高手指点一下。

 

设置如下可解决:

project, C++/language/Treat wchar_t as build-in type 是true

转载于:https://www.cnblogs.com/zhanglibo0626/archive/2011/11/18/2253663.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值