0

I want to use a C++ library in Swift: GiNaC. I have seen tutorials on how to use C++ libraries in Swift but I do not know if this will work for iOS or how to deal with dependencies. GiNaC has CLN as a dependency. How to achieve this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
MF Joney
  • 1
  • 1
  • 5
  • 1
    Generally speaking, when posting on stackoverflow, you should attempt to solve your problem and then post a question about where you're stuck. "How do I do 'x'?" isn't a valid post. – N_A Mar 14 '17 at 15:53

1 Answers1

2

C++ .h files cannot be imported in a Swift Bridging Header because Swift is not compatible with C++ only with C or Objective-C

You will probably need to use an Objective-C wrapper you create to call the C++ functions, then Swift can call the methods exposed by your Objective-C wrapper.

This thread is relevant : Can I mix Swift with C++? Like the Objective-C .mm files

Rocket Garden
  • 1,166
  • 11
  • 26