3
我創建了一個使用RTTI支持dynamic_cast的應用程序。我在Application.mk文件中添加了「APP_CPPFLAGS + = -frtti」,但是我得到錯誤:「未定義對`vtable for ...」的引用。如果我不使用RTTI,我得到的錯誤:「錯誤:‘dynamic_cast的’與不允許 - FNO-RTTI」對RTTI支持的'vtable for ...的未定義引用
有輸出我得到:
./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'
這裏是牡丹: :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); }
};
我Application.mk:
APP_STL := gnustl_static
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -DANDROID
APP_ABI := armeabi-v7a
你能幫助我嗎?
他用NDK工具鏈R5b構建了植物圖書館,支持RTTI,但他沒有在他的Application.mk fie中使用它。謝謝! – ChenHuang
那麼,你打算在沒有RTTI的情況下重建你的項目嗎? –
是的,這意味着我不會在Android的botan中使用dynamic_cast,需要重寫某些內容。謝謝你的幫助! – ChenHuang