gpt4 book ai didi

android - 对 `vtable 的 undefined reference ...具有 RTTI 支持

转载 作者:太空狗 更新时间:2023-10-29 15:15:57 32 4
gpt4 key购买 nike

我创建了一个使用 RTTI 支持 dynamic_cast 的应用程序。我在 Application.mk 文件中添加了“APP_CPPFLAGS += -frtti”,但出现错误:“undefined reference to `vtable for...”。如果我不使用 RTTI,我会收到错误消息:“错误:'dynamic_cast' 不允许使用 - fno-rtti”

我得到的输出是:

    ./obj/local/armeabi-v7a/objs/vnptsofthsm/VNPTCASoftHSM/botan_impl/global_rng.o: In function `~RandomNumberGenerator':
D:\Duongpd\Token\TMS\vnpt.example.TestSoftHSM/jni/VNPTCASoftHSM/botan_impl/../botan/../botan/rng.h:90: undefined reference to `vtable for Botan::RandomNumberGenerator'
D:\Duongpd\Token\TMS\vnpt.example.TestSoftHSM/jni/VNPTCASoftHSM/botan_impl/../botan/../botan/rng.h:90: undefined reference to `vtable for Botan::RandomNumberGenerator'
D:\Duongpd\Token\TMS\vnpt.example.TestSoftHSM/jni/VNPTCASoftHSM/botan_impl/../botan/../botan/rng.h:90: undefined reference to `vtable for Botan::RandomNumberGenerator'
D:\Duongpd\Token\TMS\vnpt.example.TestSoftHSM/jni/VNPTCASoftHSM/botan_impl/../botan/../botan/rng.h:90: undefined reference to `vtable for Botan::RandomNumberGenerator'
./obj/local/armeabi-v7a/objs/vnptsofthsm/VNPTCASoftHSM/botan_impl/global_rng.o:(.data.rel.ro+0x8): undefined reference to `typeinfo for Botan::RandomNumberGenerator'

这是 Botan::RandomNumberGenerator :

class RandomNumberGenerator
{
public:

static RandomNumberGenerator* make_rng();

virtual void randomize(byte output[], size_t length) = 0;

SecureVector<byte> random_vec(size_t bytes)
{
SecureVector<byte> output(bytes);
randomize(&output[0], output.size());
return output;
}

byte next_byte();

virtual bool is_seeded() const { return true; }

virtual void clear() = 0;

virtual std::string name() const = 0;

virtual void reseed(size_t bits_to_collect) = 0;

virtual void add_entropy_source(EntropySource* source) = 0;

virtual void add_entropy(const byte in[], size_t length) = 0;

RandomNumberGenerator() {}
virtual ~RandomNumberGenerator() {}
private:
RandomNumberGenerator(const RandomNumberGenerator&) {}
RandomNumberGenerator& operator=(const RandomNumberGenerator&)
{ return (*this); }
};

我的应用程序.mk:

APP_STL := gnustl_static
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -DANDROID
APP_ABI := armeabi-v7a

你能帮帮我吗?

最佳答案

Here人们成功地为 Android 构建了 botan 库。请注意,他们使用的是较旧的 NDK,并且根本没有 rtti 选项。很可能,您也不需要它。

关于android - 对 `vtable 的 undefined reference ...具有 RTTI 支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12814083/

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