• 2949阅读
  • 0回复

[提问]Qt DLL 中不能使用数据库 [复制链接]

上一主题 下一主题
离线hats1987
 

只看楼主 倒序阅读 楼主  发表于: 2014-01-08
Qt 4.5.3静态编译版本,生成普通带窗口的DLL可以,但是带上QtSql,代码只要写上QSqlQuery q;q.exec("....")就出错,怎么回事啊?
  1. dialog.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: bool __thiscall QSqlQuery::exec(class QString const &)" (__imp_?exec@QSqlQuery@@QAE_NABVQString@@@Z),该符号在函数 "public: __thiscall Dialog::Dialog(class QWidget *,unsigned long)" (??0Dialog@@QAE@PAVQWidget@@K@Z) 中被引用
  2. dialog.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall QSqlQuery::QSqlQuery(class QString const &,class QSqlDatabase)" (__imp_??0QSqlQuery@@QAE@ABVQString@@VQSqlDatabase@@@Z),该符号在函数 "public: __thiscall Dialog::Dialog(class QWidget *,unsigned long)" (??0Dialog@@QAE@PAVQWidget@@K@Z) 中被引用
  3. dialog.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall QSqlDatabase::QSqlDatabase(void)" (__imp_??0QSqlDatabase@@QAE@XZ),该符号在函数 "public: __thiscall Dialog::Dialog(class QWidget *,unsigned long)" (??0Dialog@@QAE@PAVQWidget@@K@Z) 中被引用
  4. release\WangWangDLL.dll : fatal error LNK1120: 4 个无法解析的外部命令

Qt 5.3.2
Win XP/7:  VC2010/ VC6 /Gcc 4.9.2
快速回复
限100 字节
 
上一个 下一个