查看完整版本: [-- 链接 dll 的问题【已解决】 --]

QTCN开发网 -> Qt基础编程 -> 链接 dll 的问题【已解决】 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

lanmanck 2020-10-09 14:51

链接 dll 的问题【已解决】

搞了一天搞不定 带界面的dll和exe调用,dll是有了,但是exe 老是提示


moc_mainwindow.obj:-1: error: LNK2001: 无法解析的外部符号 "public: static struct QMetaObject const DllTest::staticMetaObject" (?staticMetaObject@DllTest@@2UQMetaObject@@B)

参考: https://blog.csdn.net/panchang199266/article/details/104733877


[attachment=21949]

工程和测试工程一起上传:
[attachment=21950]


lanmanck 2020-10-09 15:14
搞定了,是要 加入
#if defined(DLLTEST_LIBRARY)
#  define DLLTEST_EXPORT Q_DECL_EXPORT
#else
#  define DLLTEST_EXPORT Q_DECL_IMPORT
#endif


查看完整版本: [-- 链接 dll 的问题【已解决】 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled