继承类的链接错误

发布于 2024-09-02 03:32:41 字数 607 浏览 3 评论 0原文

我有静态库和另一个使用它的程序。

在静态库中,如果我定义标头而不具有继承性,则它可以正常工作。

class TcpCommunication

另一方面,如果我将继承与 QT 类一起使用,则

class TcpCommunication:public QTcpServer

在编译使用此静态库的代码时会出现链接错误。

>MStoDKAPId.lib(TcpCommunication.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QTcpServer::~QTcpServer(void)" (__imp_??1QTcpServer@@UAE@XZ) referenced in function "public: virtual __thiscall TcpCommunication::~TcpCommunication(void)" (??1TcpCommunication@@UAE@XZ)

可能是什么问题? 谢谢。

I have static library and another program which uses it.

In the static library If I define header without inheretence it works fine.

class TcpCommunication

On the other hand If I use inheretence with a QT class,

class TcpCommunication:public QTcpServer

I'm getting linkage error when I compiling code which uses this static library.

>MStoDKAPId.lib(TcpCommunication.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QTcpServer::~QTcpServer(void)" (__imp_??1QTcpServer@@UAE@XZ) referenced in function "public: virtual __thiscall TcpCommunication::~TcpCommunication(void)" (??1TcpCommunication@@UAE@XZ)

What can be the problem?
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月棠 2024-09-09 03:32:41

您需要添加对包含 QTcpServer 类定义的库的引用。

您的 IDE 应该有一个选项来指定链接选项,其中之一是库的名称,另一个用于指定库的搜索路径。更新这两个以添加QT框架的路径/库。

You need to add a reference to the library that contains the definition of the QTcpServer class.

Your IDE should have an option to specify link options, one of which will be the names of the libraries and another to specify search paths for libraries. Update these two to add the path / library of the QT framework.

与往事干杯 2024-09-09 03:32:41

使用静态库的应用程序还需要链接到 QT

The application using your static library also needs to link to QT

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文