Objective-c bridge library in swift project not working

My swift project needs to use the snmp ++ project ( https://github.com/Zchander/mobile-snmp-plusplus ). The snmp ++ project is written in C ++ and then an objective-c wrapper is created for the functions.

The project creates a libMobileSNMP_PP.a file, which I include in my quick project, and then I create a bridge header and in the "XISMobile_SNMP_PP.h" bridge header.

Also included are .mm and .h files in the swift project, as shown in the example app image1

enter image description here

when compiled, it gives "cannot reference the bridge file in the application".

I referenced the link Is it possible to move Swift from C ++? Like Objective files - C.mm but still exist.

I even tried the steps given in the example as shown https://github.com/foundry/OpenCVSwiftStitch/tree/master/SwiftStitch but failed.

Please tell me where I am doing or will skip any step.

+3


source to share


1 answer


Tell your Swift compiler about your Objective-C bridges header?

Swift Bridging Header



If not, go to your project and click on your target. Go to the build settings and downstream, below you will see the Swift compiler, as shown in the image. Add a header file there and recompile.

+1


source







All Articles