错误:无法将 typeid 与 -fno-rtti 一起使用
当我尝试编译我的项目时,我收到此消息“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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它在消息中告诉您错误:如果您在编译器上使用
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, thentypeid
is not going to be available. Just enable RTTI; it's part of C++ after all.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 liketypeid
.See http://en.wikipedia.org/wiki/RTTI for more information about RTTI in C++.