[Your First Cross-Platform Djinni App: Part 2, iOS][1]
我遵循这个指导方针,如果我用 Object-C 项目创建新项目,一切都会很好。但是,我想使用 Swift 项目,所以我更改了项目语言并创建了一个连接 Swift 和 Object-C 的桥梁。但它行不通。
如果我尝试调用此函数,则会发生错误
let hw = LipHelloWorld.create()
Undefined symbols for architecture x86_64:
"std::__1::__shared_weak_count::__get_deleter(std::type_info const&) const", referenced from:
vtable for std::__1::__shared_ptr_emplace<personalapp::HelloWorldImpl, std::__1::allocator<personalapp::HelloWorldImpl> > in libpersonalapp_objc.a(HelloWorldImpl.o)
"std::__1::__next_prime(unsigned long)", referenced from:
请帮我!
hello_world.hpp
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from personalapp.djinni
#pragma once
#include <memory>
#include <string>
namespace personalapp {
class HelloWorld {
public:
virtual ~HelloWorld() {}
static std::shared_ptr<HelloWorld> create();
virtual std::string get_hello_world() = 0;
};
} // namespace personalapp
HelloWorldImpl.hpp
#pragma once
#include "hello_world.hpp"
namespace personalapp {
class HelloWorldImpl : public personalapp::HelloWorld{
public:
HelloWorldImpl();
std::string get_hello_world() override;
};
}
PersonalApp-Bridging-Header.h
#pragma once
#include "LipHelloWorld.h"