[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-桥接-Header.h
#pragma once
#include "LipHelloWorld.h"
答案 0 :(得分:2)
最后,我找到答案,点击我的项目 - &gt;构建设置 - &gt;全部 - &gt;链接 - &gt;其他链接器标志,将其值设置为-lc++