gpt4 book ai didi

c++ - Gold 所描述的 C++ "Key Function"是什么?

转载 作者:IT老高 更新时间:2023-10-28 12:47:50 26 4
gpt4 key购买 nike

请不要回答“我该如何解决这个错误信息?”的问题

在gold提供的错误信息中:

/usr/bin/ld.gold: the vtable symbol may be undefined
because the class is missing its key function

什么是按键功能?我在 GCC manual page for Function Attributes 中找到了它的引用。在 dllimport 部分下。相关文字如下:

On the SH Symbian OS target the dllimport attribute also has another affect (sic)—it can cause the vtable and run-time type information for a class to be exported. This happens when the class has a dllimport'ed constructor or a non-inline, non-pure virtual function and, for either of those two conditions, the class also has an inline constructor or destructor and has a key function that is defined in the current translation unit.

据此,我认为在 Symbian OS 上使用 dllimport 属性时,在某些条件下需要一些不同于构造函数或析构函数的函数。有趣,但我正在为 Linux 上的 Linux 进行编译,而 grep -r dllimport 什么也没显示。所以这一段不适用。

(FWIW 问题(在这种情况下)源自未定义的 析构函数,但链接器的文档和输出都非常费力地将“关键函数”与析构函数区分开来。对于其他类型的缺失符号,链接器拼写缺失符号的名称。)

那么,什么是按键功能 真的

最佳答案

key 函数被定义为类中声明的第一个非内联虚函数。关于它的官方 gcc wiki 是 here .

关于c++ - Gold 所描述的 C++ "Key Function"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45850063/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com