错误:无法将 typeid 与 -fno-rtti 一起使用

发布于 2024-12-25 01:23:45 字数 257 浏览 1 评论 0原文

当我尝试编译我的项目时,我收到此消息“Cannot use typeid with -fno-rtti”,我正在使用 opencv 框架。 我用谷歌搜索了这个问题,但是,我在互联网上发现的错误似乎与我的问题无关。 我不知道问题是否与包含、代码或编译器有关。

Xcode 多次给出错误,但第一个错误在这里:

virtual const std::type_info& type() { return typeid(T); }

I´m getting this "Cannot use typeid with -fno-rtti" when I´m trying to compile my project, I´m using an opencv framework.
I googled the problem but, it seems the errors I found in internet does not have relation with my problem.
I don´t know if the problem is related with the includes, the code or the compiler.

Xcode is giving me the error a lot of times, but the first error is here:

virtual const std::type_info& type() { return typeid(T); }

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

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

发布评论

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

评论(2

春风十里 2025-01-01 01:23:45

它在消息中告诉您错误:如果您在编译器上使用 no-rtti 标志,则 typeid 将不可用。只需启用RTTI即可;毕竟它是 C++ 的一部分。

It's telling you the error right in the message: if you use the no-rtti flag on the compiler, then typeid is not going to be available. Just enable RTTI; it's part of C++ after all.

梦里寻她 2025-01-01 01:23:45

RTTI 代表运行时类型信息,typeid 是一项 RTTI 功能。因此,关闭 RTTI (-fno-rtti) 也会禁用 typeid 等功能。

有关 C++ 中 RTTI 的更多信息,请参阅 http://en.wikipedia.org/wiki/RTTI

RTTI stands for Run Time Type Information, and typeid is an RTTI-feature. So turning off RTTI (-fno-rtti) also disables features like typeid.

See http://en.wikipedia.org/wiki/RTTI for more information about RTTI in C++.

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