yeyimilk
yeyimilk

Reputation: 614

Djinni swift project link error

[Your First Cross-Platform Djinni App: Part 2, iOS][1]

I follow this guidline and everything works well if I create the new project with Object-C project. However, I want to use Swift project, so I changed the project language and create a bridge to connect Swift with Object-C. But it can't work.

if I try to call this function, error happens

  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:

Please help me!

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"

Upvotes: 1

Views: 323

Answers (1)

yeyimilk
yeyimilk

Reputation: 614

Finally, I found the answer, click my project -> Build Settings --> All --> Linking --> Other Linker Flags, set its value to -lc++

Upvotes: 2

Related Questions